- Home /
kinematic trigger with static collider-no trigger message?
Hey all, just curious here:
I created a test scene which is basically just a sphere collider with a box that I can move to collide with it, in order to test the various collision combinations as seen in the collision action matrix here:
http://docs.unity3d.com/Documentation/Components/class-BoxCollider.html
I have the sphere set as trigger.
most results have come out as expected, however:
if I add a rigidbody to the sphere(trigger), it still sends a trigger message with the static box collider (as expected)... but if I set the rigidbody to "isKinematic", no trigger message is sent (to either object)
what's really weird is if I add the move script to the sphere as well, so that they both move into each other, they both receive a trigger message! (whether or not the cube still has the move script)
the move script is only this:
function Update () {
if(Input.GetKey("w"))
transform.Translate(Vector3.forward*10 * Time.deltaTime);
}
but if I turn it back off, no message. I am watching the colliders intersect, so I know they are hitting either way.. So why does adding this script make the trigger work, or rather why won't it work without it?
(instead of this move script to the sphere, I also tried adding a rigidbody to the cube instead, and this makes it work too..)
what am I missing?
EDIT: ok, thought about it for a minute, now I'm guessing the rigidbody may be sleeping, that's why it won't work.. but if that's it, why would changing it from kinematic matter? still don't quite get this, is that what it is? (anyway, according to the script reference, a static collider won't wake a rigidbody, so I'm not so sure)
on an unrelated note, while playing with this I inadvertently noticed that even when the script is disabled, the Debug log in the OnTriggerEnter function still gets called.. So does OnTriggerEnter run even if the script is turned off? what other monobehaviors would this be true for?
Your answer
Follow this Question
Related Questions
Temporarily ignore collisions between player and enemies 2 Answers
changing gravity OnTriggerEnter 1 Answer
Trying to make object turn red OnTriggerEnter 0 Answers
get only one colliding body 3 Answers
Speed/trigger only working once 0 Answers