Hello,
So I want to freeze gameObject when it is inside my trigger collider and un-freeze it when i took it of from there.
I wrote a code that menages to switch isKinematic on and off according to position of the object, but OnTriggerExit do not switch property of the object properly, even if Debug.Log sucessfuly shows taht object is out of the trigger.
Those are my Trigger methods:
private void OnTriggerEnter(Collider other) {
Debug.Log("Enter Collider by " + other);
}
private void OnTriggerStay(Collider other) {
Debug.Log("Stay in Collider by " + other);
other.attachedRigidbody.isKinematic = true;
}
private void OnTriggerExit(Collider other) {
Debug.Log("Exit Collider by " + other);
other.attachedRigidbody.isKinematic = false;
}
It is simple, but should work. Am I doing something wrong, or it is problem with design of OnTriggerExit?