Collision problem

Okay i have a collision problem.

I need 2 object to Debug.log(“hit”); when hit

but these 2 object donnot collider by hiting each other, they are moving with script:

function Update ()
 {
 if(transform.position.z >= -10.15966)
 {
 	if(Speed.paused == true)
 	{
 	 transform.Translate(Vector3(0,0,-0.00));
 	}else{
 		transform.Translate(Vector3(0,0,-0.03*Speed.speed));
 	}
 }else{
 Destroy(gameObject);
 }

As you can see im not using any force, so these object just flying though each other.

So how do i solve this problem?

Those colliders will ned some rigidbodies to know their hitting each other , or you will have to script around the OnTriggerEnter , OnCollisionEnter, etc …

Willc, what is your adress?

I’ve heard that what you are doing works. But reading over all the documentation makes me think it wouldn’t.

Unless Translate works differently than just setting .position (which it could) it basically warps the object without doing collision detection.

At any rate, since your basically doing something like velocity, use forces. With that said though i do not think that two kinematic rigidbodies will collide or make collision messages against eachother. So if they both are moving they should both be non kinematic.

Willc the thing about adress was because it work! THANKS!

BDev it work with rigidbody

Cool, You should probably still use forces. Otherwise you should change your code
-0.03*Speed.speed
you probably want
-Time.deltaTime * Speed.speed