x


Character Controller is not interacting with colliders.

I am currently in the process of building a game where I have a button that, when it collides with something with the tag "Opener" it would play an animation that opens a door. For now, to test the script, I just make it destroy itself when it follows the script. I tested it by putting it on a cube, and then putting another cube with the opener tag on it above it, so that when they collide one would dissapear. This worked. However, when I tried to do it with my character controller (the prefab that comes with Unity), it would not respond. I have to add a rigidbody to it, to the graphics, and even another collider but nothing worked. Here is my script:

function OnCollisionEnter (other : Collision) 
{
if (other.gameObject.tag == "Opener")
Destroy( gameObject);
}
more ▼

asked Jan 04 '11 at 05:11 PM

Timmyglen2 gravatar image

Timmyglen2
26 13 14 21

I feel that i should mention that my character does not go through the cube, it just refuses to work with the script.

Jan 05 '11 at 12:00 AM Timmyglen2
(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

Make sure the character has a collider on it...

more ▼

answered Jan 04 '11 at 10:49 PM

Justin Warner gravatar image

Justin Warner
6.3k 19 27 65

the character controller has a collider on it in the prefab

Jan 04 '11 at 11:02 PM Timmyglen2
(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:

x3568
x1947
x336

asked: Jan 04 '11 at 05:11 PM

Seen: 1333 times

Last Updated: Jan 04 '11 at 05:11 PM