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

Collide() public method

public Collide ( uint collidingWith, BSPhysObject collidee, OpenMetaverse contactPoint, OpenMetaverse contactNormal, float pentrationDepth ) : bool
collidingWith uint
collidee BSPhysObject
contactPoint OpenMetaverse
contactNormal OpenMetaverse
pentrationDepth float
return bool
        public virtual bool Collide(uint collidingWith, BSPhysObject collidee,
            OMV.Vector3 contactPoint, OMV.Vector3 contactNormal, float pentrationDepth)
        {
            bool ret = false;
            bool p2col = true;

            // We only need to test p2 for 'jump crouch purposes'
            if (TypeName == "BSCharacter" && collidee is BSPrim)
            {
                // Testing if the collision is at the feet of the avatar
                if ((Position.Z - contactPoint.Z) < (Size.Z * 0.5f))
                    p2col = false;
            }

            // The following lines make IsColliding(), CollidingGround() and CollidingObj work
            if (p2col)
                CollidingStep = PhysicsScene.SimulationStep;
            TrueCollidingStep = PhysicsScene.SimulationStep;

            CollisionAccumulation++;

            // For movement tests, remember if we are colliding with an object that is moving.
            ColliderIsMoving = collidee != null ? (collidee.RawVelocity != OMV.Vector3.Zero) : false;
            ColliderIsVolumeDetect = collidee != null ? (collidee.IsVolumeDetect) : false;

            // If someone has subscribed for collision events log the collision so it will be reported up
            if (SubscribedEvents())
            {
                CollisionCollection.AddCollider(collidingWith,
                    new ContactPoint(contactPoint, contactNormal, pentrationDepth, (ActorTypes)PhysicsActorType));
                DetailLog(
                    "{0},{1}.Collison.AddCollider,call,with={2},point={3},normal={4},depth={5},colliderMoving={6}",
                    LocalID, TypeName, collidingWith, contactPoint, contactNormal, pentrationDepth, ColliderIsMoving);

                ret = true;
            }
            return ret;
        }