0 votes

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

in Engine by (689 points)

1 Answer

+1 vote
Best answer

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
by (7,896 points)
selected by

Beautiful thank you!

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.