Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business

Forums

OverviewFelgo 3 Support (Qt 5) › Collider shifted on Android

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #7784

    Vlad

    Hi

     

    It seems collider (box or circle) is shifted on android to the right (in my case) of the entity

    No problems on linux desktop

    Any ideas?

     

    Vlad

    #7803

    Alex
    Felgo Team

    Hi Vlad,

    could you post any sample code that shows the problem?

    Cheers,
    Alex

    #7808

    Vlad

    Hi Alex

     

    it happens when Level is anchored scene.gameWindowAnchorItem

    but only for android, which is weird

     

     

    #7809

    Alex
    Felgo Team

    Hi Vlad,

    is your PhysicsWorld within the scene or within the level?

    Make sure your PhysicsWorld is within the same Item that you use as entityContainer (in your case the level seems to be the right choice), or else Box2D would have to deal with 2 different coordinate systems, which can result in colliders appear to be shifted.

    You are experiencing this on Android because the devices have a different aspect ratio than on your desktop. Therefore the gameWindowAnchorItem will be bigger than the scene. I suspect your PhysicsWorld is in the scene and the entities are in the level? But since you anchor the level to the gameWindowAnchorItem, the 0|0 coordinate of the scene (and therefore of the PhysicsWorld) has a different position than the 0|0 coordinate of the level on the screen.

    Now if your entity has a position of 50|50, the visual representation (50|50 within the level item) won’t match the physical representation (50|50 within the PhysicsWorld which is your scene).

    Cheers,
    Alex

     

    • This reply was modified 9 years, 10 months ago by  Alex.
    • This reply was modified 9 years, 10 months ago by  Alex.
    • This reply was modified 9 years, 10 months ago by  Alex.
Viewing 4 posts - 1 through 4 (of 4 total)

RSS feed for this thread

You must be logged in to reply to this topic.

Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded