Page 1 of 1

V2 ContactEventsDemo Question

Posted: Thu Dec 26, 2019 12:34 pm
by b1fg2
I do know OnContactAdded in ContactEventsDemo, but any simple guide for OnTouching and OnContactRemoved?

Re: V2 ContactEventsDemo Question

Posted: Thu Dec 26, 2019 6:59 pm
by Norbo
Not at the moment- the ContactEventsDemo was intended to be it, I just didn't want to make it extremely long. The idea for OnContactRemoved is similar to OnContactAdded; when a contact that was previously seen is no longer there, invoke a callback. OnTouching is simpler because it doesn't require tracking previous state.

My personal recommendation is to avoid 'transition' events OnContactAdded/Removed if possible because they add nontrivial complexity. You can almost always get away with current-state-only analysis with a little logical refactoring.