Forums

OverviewV-Play 1 SupportComplex Box2D Components › Reply To: Complex Box2D Components

OverviewV-Play 1 SupportComplex Box2D Components › Reply To: Complex Box2D Components
#4203

Christian
V-Play Team

Hi Thomas,

it took me a while to figure out the issue here:

Your comparsing between the 2 use-cases is actually not the same: for the first one where all works as expected, you use 2 separate entities for the middle and the bottom part that get connected with 2 ropes. For the second test, you only use 1 entity with 2 BoxColliders in it. And this is also the source of the problem: There must only be a single one BoxCollider, CircleCollider, etc. in a game entity. The reason for that is, that the entity position gets set to the one calculated for the collider. So if there are more than 1, the entity gets changed from 1 collider position to the other, and that’s why the screen is flickering.

 

Long story short, please design your entities like in the first example, where you have the connecting entities with a BoxCollider, and then the RopeJoints as an own entity. You could write a QML file that handles the dynamic creation and destruction of the rope elements then, and which takes your desired input parameters specifying the rope (chain elements, lenght of each joint come into my mind).

If you want multiple fixtures (e.g. a Box or a Circle is a fixture, and BoxCollider and CircleCollider are convenience wrappers by us as single colliders per entity are most common), you can derive your own physics components from ColliderBase. Please have a look at our implementation of BoxCollider.qml and CircleCollider.qml in the V-Play SDK sources, and also ColliderBase.qml will be for interest in that case for you. As a side note: did you think about how you will draw your rope parts then, because you would need to do all the transforms for each joint and connecting element manually.

Does this solve your issue?

Cheers,

Chris

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