Detect collision with multiple collisonshapes of one characterbody

Godot Version

Godot 4.2.1


Hello! I’ve set up my player model scene with root CharacterBody3D and multiple CollisionShapes3D as parts of its body (head, arms, legs, torso). Another player shooting with raycast should detect the exact hitbox that was affected by shot, but raycast.get_collider() returns only CharacterBody3D. How can I get the exact hitbox that was hit? Thank you!
Image of scene with player:

1 Like

Raycast has a raycast.shape property that’s the index of the colliding collision shape. collisionhead should have the index 0 for example, body is 1 etc…

edit: actually i think you can get the index with raycast.get_collider_shape(), i confused it with how input events work i think…

1 Like

It’s pretty much like that, just using getter raycast.get_collider_shape() is the thing I want. Thank you a lot!!!


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.