Universe.Physics.BulletSPlugin.BSPhysObject.SendCollisions C# (CSharp) Method

SendCollisions() public method

public SendCollisions ( ) : bool
return bool
        public override bool SendCollisions()
        {
            bool ret = true;

            // If the 'no collision' call, force it to happen right now so quick collision_end
            bool force = (CollisionCollection.Count == 0 && CollisionsLastTick.Count != 0);

            // throttle the collisions to the number of milliseconds specified in the subscription
            if (force || (PhysicsScene.SimulationNowTime >= NextCollisionOkTime))
            {
                NextCollisionOkTime = PhysicsScene.SimulationNowTime + SubscribedEventsMs;

                // We are called if we previously had collisions. If there are no collisions
                //   this time, send up one last empty event so Universe can sense collision end.
                if (CollisionCollection.Count == 0)
                {
                    // If I have no collisions this time, remove me from the list of objects with collisions.
                    ret = false;
                }

                DetailLog("{0},{1}.SendCollisionUpdate,call,numCollisions={2}", LocalID, TypeName,
                    CollisionCollection.Count);
                base.SendCollisionUpdate(CollisionCollection);

                // Remember the collisions from this tick for some collision specific processing.
                CollisionsLastTick = CollisionCollection;

                // The CollisionCollection instance is passed around in the simulator.
                // Make sure we don't have a handle to that one and that a new one is used for next time.
                //    This fixes an interesting 'gotcha'. If we call CollisionCollection.Clear() here, 
                //    a race condition is created for the other users of this instance.
                CollisionCollection = new CollisionEventUpdate();
            }
            return ret;
        }