- Home /
Unparent Character Controller from rigidbody?
Ok. As far as i understand, if i parent CharacterController to object, that have rigidBody and collider, attached to it, after that the OnTriggerExit doesn't work because Unity is not checking the collisions between the children of rigidBody object..
Ok, but how can i check wheter the character controller is leaving the trigger, that makes him parented?
1: I have a box with 2 colliders (One cube and one capsule). The capsule is trigger. When the CC get's inside the trigger area it get's parented to the cube and after that the OnTriggerExit doesn't detect the CharacterController anymore...
So any help on how i can check, when the character controller leaves the trigger collider?
thanks
Answer by clunk47 · Oct 10, 2013 at 09:26 PM
If you want to check collision on a CharacterController, have a look at OnControllerColliderHit. To check if something has a parent or not,
if(transform.parent == null){print("No parent for Transform.")};
hm. Does that means, that i can't have a script on the object, that the character will be parented to? And then just say OnTriggerExit (meaning when character exit) character.transform.parent = null?