0 votes

I have a 3D object with a rigid body that has the mode set to kinematic and only moves using global_translate in one direction. It collides with another 3D object that has a rigid body with the mode set to rigid body and moves with translate_object_local. How can I detect the collision through script? I've looked up a ton of things and have had no luck. I've tried using move_and_collide but it just gave me problems with the collision in the game.

asked Jul 26 in Engine by ryan329 (19 points)

1 Answer

0 votes

There is two of doing so, you can either use the signals like body_entered or call get_colliding_bodies in _physics_process.

answered Jul 26 by BraindeadBZH (1,017 points)

I've tried those before and couldn't get them to work. Does the script need to be on a certain node for it to work? For example, does it need to be on the object node, RigidBodynode, or CollisionShape node?

For get_colliding_bodies yes, but for the signals no, you can connect the signals using the IDE.

Forgot to mention that you need to contact_monitor set to true and contacts_reported to something greater than 0.

Doesn't contact_monitor only work with RigidBody2D?

contact_monitor is a property of RigidBody2D and RigidBody, I use it and it works.

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.