How to check if an object is colliding with another?

Hey guys,

I have searched Unity Answers and tried different collision scripts, but none of them seem to work. The console has no errors, and i have added box colliders to both the objects. Is there a simple script in which i can use to check if two objects are hitting each other, and then execute some code if they are…

Here is the script that i am currently trying to use:

var collisionObject : GameObject;

function OnCollisionEnter(collision : Collision){
	if (collision.gameObject.name == collisionObject){
		Application.LoadLevel("game_scene_01");
	}
}

Thanks

-Grady

I do not know if you already done that but:

One of your objects need to be a non-kinematic rigidbody (or charactercontroller) for collisions to work.

http://unity3d.com/support/documentation/ScriptReference/Collider.OnCollisionEnter.html

does the collision script go into the character controller or the rigidbody script?

I am trying to create a monster truck game where I can use a monster truck to crush junkyard cars…

I am using Unity 5 and using the skycar from the standard asset, but changed it so it resembles a monster truck…

I have downloaded a junk car in the assets store with multiple damage levels,

I want it to use its level 1 mesh before hitting it and then when hit by one of the wheels of the monster truck, to gradually change to level 2, then 3, 4 and finally 5.

I have added box colliders to the junk cars mesh levels,
and currently (initially) level 2,3,4 and 5 meshes have their collider and mesh renderer unticked

how can I detect if a monster truck wheel hits the car?

my main body of the monster truck has a rigidbody but the wheels have not and it will always be one of the wheels that will hit the junk car

I can’t just add rigid body, no cinematic and no gravity to my wheels can I?
And if I can, do I then add the check to the cars carcontroller script, a script applied to each wheel,
the junk car or something completely different ??

thanks in advance for any help…