Problem rigidbody2d

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By lalel345

I have an arrow in a rigidbody in my 2d game but when i shoot it rebound on the body, by the physics and I want it to stay locked in place for more realism.
what should I do?

:bust_in_silhouette: Reply From: Bernard Cloutier

When you detect a collision, you could set the arrow’s RigidBody mode to MODE_STATIC.

To detect collisions on a rigid body, you must first enable the contact monitor property. Then, you can connect your arrow’s body_entered signal.

The rigid body can only report on collisions with other rigidbodies though. and setting the arrow to MODE_STATIC will make it stay hovering in space, it won’t stick to the target if it moves. To correct that, you can add the arrow a child of its target.