- Home /
Two different spheres attached to one object for collisions
I have this trigger. It is on an object.
Then I have another object. namely the knight object. It has two spheres attached to it, two collision spheres with different names. So the hierarchy is
knight
-sense (larger sphere)
-aggro (smaller collision sphere)
-armature
--armature stuff
-lamp
..etc
function OnTriggerEnter (col : Collider) {
print(col.name + " is the colname, to string its " + col.name.ToString() + " type is: " + typeof col.name );
if (col.name.ToString() == "sense"){
//Destroy(other.gameObject);
print("aggro'd");
animateKnight.aggro = true;
//animateKnight.aggro = false;
} if (col.name.ToString() == "aggro"){
print("aggrosens'd");
animateKnight.aggroSense = true;
//animateKnight.aggroSense = false;
}
}
So what happens is when I run into the larger sphere it prints aggro'd and aggrosens'd
:/
Which is dumb because the sphere that prints aggro is smaller and I haven't touched that sphere yet. Before I had the larger sense sphere it bheaved normally.
http://docs.unity3d.com/Documentation/Components/class-Rigidbody.html
is it possible you have unwittingly made a compound collider?
Your answer
Follow this Question
Related Questions
Player registering collisions where there are none 0 Answers
How to detect which side of my player has collided? 2 Answers
Collision Detection Issue – Player in the corners 1 Answer
collisions will sometimes be detected and sometimes will not 1 Answer
Unity2D: How to make my player not walk through walls? 1 Answer