x


Controller Collider Script

I am making trying to find a script to bring you to a different menu when the first person controller prefab falls into the daylight water. This is how I am using the script:

function OnControllerColliderHit(hit : ControllerColliderHit) { if (hit.gameObject.name == "EndGame Water") { Application.LoadLevel(6); } }

It's not working, help? I added box collider, then trigger, then this script to the water. =[ (6) is what I want it to get to

more ▼

asked Jul 16 '10 at 03:42 AM

Collinbxyz gravatar image

Collinbxyz
109 23 24 33

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

1 answer: sort voted first

hi,

The OnControllerColliderHit gets called on the player itself, so the script with that function in it needs to be attached to the player object (with the Character Controller component).

also don't set the collider to be a trigger or the OnControllerColliderHit event wont register. (and finally make sure the game object is named correctly to match the one you are looking for)

hope this helps

more ▼

answered Jul 16 '10 at 04:18 AM

andrew gravatar image

andrew
549 10 12 18

(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:

x3337
x1705
x986
x300
x179

asked: Jul 16 '10 at 03:42 AM

Seen: 2103 times

Last Updated: Jul 16 '10 at 03:42 AM