- Home /
Detect when CharacterController is not colliding? (SOLVED)
Like as per usual I had an epiphany and solved the problem I was having... bollocks. (I mean its a good thing I solved it but why is it always after I post a question?!)
If anybody wants a detailed explanation of what my problem was and how I solved it just ask and I'll post it.
Collision events are only sent if one of the colliders also has a non-kinematic rigidbody attached. If you could add that to the things you're colliding with, OnCollisionExit would work.
Okay, so i tried that and it looks like OnCollisionExit actually isn't going to do the trick. I'll update the original question with a more detailed explanation of my problem I guess.
Hey crazymonkey, if you don't $$anonymous$$d my asking, what was the epiphany you had? I'm encountering a similar problem with my project, I need platforms to disappear after my character steps off them so the collision exit detector would really come in handy.
I know this is really late to the party but I appreciate you taking the time to read this!
Answer by Em3rgency · Jun 23, 2013 at 08:48 PM
bool colliding = false;
void update()
{
if(!colliding)
{
//do your thing
}
}
void OnCollisionEnter(Collision collision)
{
colliding = true;
}
void OnCollisionExit(Collision collision)
{
colliding = false;
}