- Home /
Collision problem
Hello. I've been following this example to the letter. http://www.raywenderlich.com/4551/how-to-make-a-2-5d-game-with-unity-tutorial-part-1
Everything's been working well until I got to the end with the collision. Code seems totally fine, I double checked to make sure the bomb was a rigid, and tweaked the coordinates to make sure it was hitting. The bomb goes right through the shark model, but nothing happens. Deprecated code? It's hard to debug because code has no errors, and double checked the naming of the targets as well.
Here's the collision code.
void onTriggerEnter(Collider obj)
{
if(obj.gameObject.name == "Shark") {
obj.gameObject.transform.rotation = Quaternion.identity;
obj.gameObject.transform.position = new Vector3(20f, -3f, 8f);
Destroy(this.gameObject);
}
}
Answer by 4004 · Apr 07, 2013 at 08:06 PM
Main setup I have is one object with trigger on, that's a prefab with Rigidbody. Everything else is pretty much stock objects with a collider object, no trigger, no rigidbody.
The matrix looks like this might not match up, but I've altered it to match what I consider to be a positive in the matrix, to no avail.
I feel like this is a super simple fix, but something is just overlooked or wrong.
Here's my code if that helps. https://www.dropbox.com/sh/m3prep5f5ywtww9/FZeSaaJWL1?dl=1
Your answer
Follow this Question
Related Questions
2d collision according to sprite image 1 Answer
Help with OnCollision 2 Answers
Collider help (read description) 2 Answers
Parenting after X time with collision, I dont get it! 1 Answer
Spawn rigidbody on collision 1 Answer