- Home /
Precise hitboxes for characters
Hello,
until now i used a prefab for AI controlled characters similar to the one described in the FPS tutorial, which is based on the character controller. However, the character controller simply uses a capsule collider. Though thats fine for calculating collisions with the world, its not the most realistic way of calculating gunshot hits, since you can easily kill a character by shooting past him, still hitting the capsule. It also prevents me from having different hit zones, that i would like to use (taking a bullet in the head tends to be more lethal than a hole in you arm ^^). My approach was to have the root game object that contains the AI script in one layer, and a child with another collider in another layer, using the root for world collisions only and the child for the bullets. Though that works, i have no idea how to make colliders follow the current animations, e.g. attach them to bones.
Any ideas?
Answer by ShadowBroker · May 01, 2011 at 08:44 PM
I think the only way to make it, is to attach seperate capsule colliders to the bones(don't forget to use at least one character collider, because you can't controll a normal collider). All bones are just transforms in Unity, so add a component(no child object with a collider, add a collider as a component!).
thanks, wonder why i didnt think of that myself. guess sometimes the answer is to obvious to see it works great now
Your answer
Follow this Question
Related Questions
Simple AI and Animation 2 Answers
Same script, different properties to curtain objects 1 Answer
sample of AI enemy collision 1 Answer
How to get the enemy jumping all around? 0 Answers
enemy AI avoiding collision 1 Answer