I’m halfway through my Game Production but i’m having trouble with collisions, each object (that I want to collide) has a rigidbody, isKinematic turned off, and a relative force added plus a physics material added to the mesh collider, but whenever I run the program and set it so that a certain amount of objects collide with each other, they just pass straight through each other as if the colliders weren’t there.
However my bullet script works fine when detecting that it has hit something, but I thought the Unity Engine was supposed to be able to handle this kind of stuff with world collisons without the need for extensive coding.
Here is my script so far (for the objects I want to collide)
#pragma strict
var object : GameObject;
function Start()
{
for (var i : int = 0; i < 100; i++)
{
var AsteroidSpeed : Vector3 = Vector3 (0,0,1);
var position : Vector3 = Random.insideUnitSphere * 500;
transform.position.x = position.x;
transform.position.y = position.y;
transform.position.z = position.z;
var rotation = Quaternion.Euler ( Random.Range (0, 360), Random.Range (0, 360), Random.Range (0, 360) );
Instantiate (object, position, rotation);
rigidbody.isKinematic = false;
rigidbody.detectCollisions = true;
rigidbody.MovePosition ( rigidbody.position + AsteroidSpeed * Time.deltaTime);
yield WaitForSeconds (0.0001);
}
}
Any help would be much appreciated as I’m banging my head against the wall here