Problem with collision in my game.

Hi

I have problem with collision detection in my game. I wrote script:

#pragma strict
var myLevel : String;

function OnCollisionEnter (myCollision : Collision) {


 if(myCollision.gameObject.name == "WoodBarrel"){


  Application.LoadLevel(myLevel);

}

}

I added to my car and when checked - script doesn’t work. New level doesn’t start. I added two box collider to car and woodbarrel.

My woodbarrel looks like:
14673-woodbarrel.png

My car collider:
14674-car_collider.png

I took the script from Unity 3D Student - 3d Modelling

How to make collision which work?

Collision’s require a Rigidbody to work, you can apply it to your woodbarrel (Or what ever else you want to set off the level loading) by highlighting it then on the top menu bar clicking “Component → Physics → RigidBody”

http://www.unity3dstudent.com/2010/07/beginner-b00-adding-mass-gravity/

I solved my problem with collision. I used playmaker. I made collision:

[14705-bez+tytułu.png|14705]

I added two box collider and rigidbody to my objects (car and barrel) and collision works.