Forums

OverviewV-Play 1 SupportItem Movement › Reply To: Item Movement

OverviewV-Play 1 SupportItem Movement › Reply To: Item Movement
#6454

Alex
V-Play Team

Hi KitKat,

the problem is the following: You are not really “moving” anything at all, all your code does is specify a new x position for the Box2DBody within the BoxCollider within the Entity. That’s why it looks like the collider is moving without the entity, well in fact you are just changing the position of the collider within the entity.

Instead you should move the entity itself, which will cause the collider to move with it. And here is how you do that:
The parent of the body is the boxcollider and the parent of the boxcollider is the entity. This means instead of “selectedBody.x” you need to change “selectedBody.parent.parent.x”. You could of course save the selected entity in a property variant (like the Body), to make it more readable than lots of .parent.parent calls.

Cheers,
Alex

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