Sprite not moving with RigidBody2d

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By jarlowrey
:warning: Old Version Published before Godot 3 was released.

After wondering why my sprite wasn’t moving, I enabled visible collision shapes and watched as my rigid body floats away without the sprite. Any idea what could be going wrong here? I want the bullet sprite to move along with its rigid body.

enter image description here

The blue square should move with the blue bullet, but is floating away
enter image description here

:bust_in_silhouette: Reply From: eons

The parent transform affects the children, here, the RigidBody2D is child of the Sprite, parent movement may affect the body but the physics engine will do that too producing an undesired situation.


When you make a CollisionObject based scene, you need to create it this way

Body on root (+script if needed)
|-Sprite (or whatever is the visual representation)
|-Shape1 (if added with the editor)
|-Shape2
|-ShapeN
|-All extra things that depends on body movement

Beautiful thank you!

jarlowrey | 2017-05-04 12:59