0 votes

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?

in Engine by (183 points)

1 Answer

0 votes

When you detect a collision, you could set the arrow's RigidBody mode to MODE_STATIC. https://docs.godotengine.org/en/latest/classes/class_rigidbody.html#enum-rigidbody-mode

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.

by (1,088 points)
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 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.