Get collision point without a Raycast

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

Hi,

Is there a way of retrieving the collision point between a rigid body-rigid body/static body collision, without using a raycast? Simple example: a rigid body sphere falls and collides with a static plane (e.g. the ground), is there a way of finding the point of contact using GDScript?

Thanks

:bust_in_silhouette: Reply From: kidscancode

Yes, in _integrate_forces() you can access the PhysicsDirectBodyState, which contains methods for obtaining a wide variety of collision data, including get_contact_local_position().

See also Physics Introduction for an example of using the direct body state.

Thanks a lot! It works!

MangoTree | 2019-04-19 19:06