- Home /
Duplicate Question
On collision load level
I need to have the next level load when the player contacts the cube here is what I have this script has been added to the cube
function OnCollisionEnter(collision : Collision) {
Application.LoadLevel (2);
}
When the player hits the cube nothing happens
Does the player have a collider attached? Does the cube have a collider attached? Does the player have a rigid-body attached? Does Level 2 actually exist, i.e, is it added to the project in the build settings?
yes, yes, no but when i add one it the first person script stops working, and yes
Two things:
1) Try making the cube a rigidbody
2) For collisions with the character controller, you generally need to use OnControllerColliderHit on the character controller, ins$$anonymous$$d of OnCollisionEnter , but of-course your script is attached to the Cube, not the character controller, so its fine.
Follow this Question
Related Questions
Collide detection with tag [JS] 0 Answers
Car dynamics? 0 Answers
2D Collision 1 Answer
Enemy death help 1 Answer
NullReference on Collision 1 Answer