- Home /
CharacterControllers don't register collisions with each other?
I've got a projectile that uses a charactercontroller, and an npc that uses one also.
For some reason, the OnControllerColliderHit registers when the projectile hits the terrain, but not the npc. I know the projectile is hitting the npc, because the projectiles visibly bump the npc.
This post discusses characters controllers and rigidbodies: http://answers.unity3d.com/questions/149/guidelines-for-using-rigidbody-collider-charactercontrollerscript-etc
But I'm still not "getting it", I'm afraid. A different post states that npcs should generally be used with CharacterControllers, but I seem to recall a different post stating that CharacterControllers don't work well together regarding collisions. So...I'm confused on what to use when. I understand triggers only work with rigidbodies. Should I have game objects with CharacterControllers AND rigidbodies? I guess I'm still confused about what type of controller/setup to use with various types of objects, and the caveats that go along with that regarding collision. For all I know, my projectiles should be rigidbodies, my npcs should be character controllers...in same cases. Anyone clear this up a little for me?
Answer by Eric5h5 · Apr 05, 2010 at 04:46 AM
You can always add another collider to the npcs, which the character controller will register collisions with in OnControllerColliderHit.
Rather than messing about with different FPS controllers like the RigidbodyFPSWalker mentioned by dhendrix, for basic collision detection where you're already using FPS controllers, the addition of a basic collider is the easiest solution.
So if I have CharacterControllers colliding in my game, there's no callback to say the two things collided?
Basically I want a controller so that my NPCs don't walk through each other, but I want to be able to detect a hit and take action accordingly.
How in the world are both of the answers on this page marked as accepted?
Answer by dhendrix · Apr 05, 2010 at 03:43 AM
This is my personal opinion, but if you want to detect collision between multiple CharacterControllers, then personally I would say to ditch them and use this instead:
Despite the name(FPS), its great a base for any kind of character, and provides fluid movement with rigidbodies. But no there isn't any easy way to detect collision between CharacterControllers, which is why I tend to avoid them. Hope this helps you.
So in general, should I just use ridigbodies for anything that moves, such as npcs or projectiles?
In most cases I would, though if your projectiles are really fast you may want to do a Raycast to detect a collision and just use a bullet for visual aid only.
Really you should use whatever components you need to easily detect collisions between desired objects.