|
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?
(comments are locked)
|
|
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.
Dec 04 '10 at 10:09 AM
thundercat
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.
Nov 25 '12 at 07:04 PM
Bovine
(comments are locked)
|
|
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?
Apr 05 '10 at 11:25 PM
jc_lvngstn
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.
Apr 05 '10 at 11:30 PM
dhendrix
(comments are locked)
|
