Forums

OverviewV-Play 2 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
    V-Play 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
    V-Play 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 4 years, 1 month ago by  Alex.
    • This reply was modified 4 years, 1 month ago by  Alex.
    • This reply was modified 4 years, 1 month 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.

Voted #1 for:

  • Easiest to learn
  • Most time saving
  • Best support

Develop Cross-Platform Apps and Games 50% Faster!

  • Voted the best supported, most time-saving and easiest to learn cross-platform development tool
  • Based on the Qt framework, with native performance and appearance on all platforms including iOS and Android
  • Offers a variety of plugins to monetize, analyze and engage users
FREE!
create apps
create games
cross platform
native performance
3rd party services
game network
multiplayer
level editor
easiest to learn
biggest time saving
best support