// called by physics engine to handle changes of the proximity detector of the physics engine // the events are very raw and the real proximity (between vertices/surfaces to vertices/surfaces) must be calculated by this void objectHandler(ProximityDetector.EnumEventType eventType, PhysicsComponent @object) { if( physicsComponentBlacklist.Contains(@object) ) { return; } // TODO< calculate detailed distance checks > detailedHandleProximity(eventType, @object); }
// called when all prefiltering and detailed distance checks succeeded void detailedHandleProximity(ProximityDetector.EnumEventType eventType, PhysicsComponent @object) { switch( eventType ) { case ProximityDetector.EnumEventType.ENTER: calledComponent.@event("proximityEnter", new Dictionary<string, object> {{"object", @object}}); break; case ProximityDetector.EnumEventType.EXIT: calledComponent.@event("proximityExit", new Dictionary<string, object> { { "object", @object } }); break; case ProximityDetector.EnumEventType.INSIDE: calledComponent.@event("proximityInside", new Dictionary<string, object> { { "object", @object } }); break; } }