Just wondering how would I go about getting the collision point from a collision on a RigidBody3D object? I can get the colliding bodies okay but I’m struggling to get more info than that. Could someone point me in the right direction here?
Not sure if it matters but I’m using Jolt by the way.
First of all, you need to have contact_monitor enabled and max_contacts_reported bigger than 0
func _physics_process(delta: float) -> void:
# Get body rid
var rid := get_rid()
# Get body physics state
var state := PhysicsServer3D.body_get_direct_state(rid)
# For get the position, you need to get the collision index, if you're colliding
# with one body, will be 1, if more, will be the amout of body collisions
for i in get_contact_count():
# Print the collision position
print(state.get_contact_collider_position(i))