How do you detect which collision shape in a RigidBody has been hit?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By avencherus
:warning: Old Version Published before Godot 3 was released.

I have a RigidBody in 3D that has two collision shapes. Once the body reports contacts, say against a StaticBody like a platform, how would I detect which shapes are making contact?

I’m doing this within _integrate_forces()

So I can get the objects, but I can seem to find what is available from there to resolve which shape is making contact.

func _integrate_forces(state):
	
	var contacts = state.get_contact_count()
	
	if(contacts > 0):
		for i in range(contacts):
			get_something(i).i_hit_this_shape()???

I’m overlooking something… Can anyone kindly point me to a method for this kind of query?

:bust_in_silhouette: Reply From: avencherus

So for any future visitors, it’s:

state.get_contact_local_shape(i)

Giving it the contact index, returns the shape’s index inside the parent RigidBody.