x


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?

more ▼

asked Apr 04 '10 at 09:24 PM

jc_lvngstn gravatar image

jc_lvngstn
453 24 29 40

(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first

You can always add another collider to the npcs, which the character controller will register collisions with in OnControllerColliderHit.

more ▼

answered Apr 05 '10 at 04:46 AM

Eric5h5 gravatar image

Eric5h5
80.1k 41 132 519

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)
10|3000 characters needed characters left

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:

RigidbodyFPSWalker

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.

more ▼

answered Apr 05 '10 at 03:43 AM

dhendrix gravatar image

dhendrix
2.2k 25 34 59

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)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x2482
x1780
x669

asked: Apr 04 '10 at 09:24 PM

Seen: 3685 times

Last Updated: Nov 25 '12 at 07:04 PM