Hi,
I am having some real trouble with collision detection.
I have a ship and some 2 different size asteroids. I can get the ship to collide just fine with one of the asteroids. It wont collide with the second size.
I have since tried to add new objects, just a simple cube with box collider, and I cannot even get the ship to hit that either!
So I am close to giving up on Unity, I have spent over 3 weeks now just trying to get an object to hit another.
Simple question: Can one object hit more than 2 others using the function OnTriggerEnter (other : Collider) code?
here is my detection code which is in one of the scripts attached to the ship…
function OnTriggerEnter (other : Collider)
{
if ( other.GetComponent( testcol) )
{
print("hit cube!");
//This NEVER works!!! a simple cube with a box collider and a script component attached to it called testcol
}
if ( other.GetComponent( ProgressAsteroid) !ship_dead )
{
print("Hit asteroid!");
//This works!! There
}
}
Perhaps there are some rules regarding other.GetComponent() which I havent worked out yet, I am at a loss to work out what I am doing wrong.
Thanks in advance for any help.[/code]