SetVelocityAndTarget() public method

public SetVelocityAndTarget ( OpenMetaverse vel, OpenMetaverse targ, bool inTaintTime, int targetValueDecayTimeScale ) : void
vel OpenMetaverse
targ OpenMetaverse
inTaintTime bool
targetValueDecayTimeScale int
return void
Example #1
0
        void SetPhysicalProperties()
        {
            PhysicsScene.PE.RemoveObjectFromWorld(PhysicsScene.World, PhysBody);

            ForcePosition = RawPosition;

            // Set the velocity
            if (m_moveActor != null)
            {
                m_moveActor.SetVelocityAndTarget(RawVelocity, RawVelocity, false, 0);
            }

            ForceVelocity  = RawVelocity;
            TargetVelocity = RawVelocity;

            // This will enable or disable the flying buoyancy of the avatar.
            // Needs to be reset especially when an avatar is recreated after crossing a region boundry.
            Flying = _flying;

            PhysicsScene.PE.SetRestitution(PhysBody, BSParam.AvatarRestitution);
            PhysicsScene.PE.SetMargin(PhysShape.physShapeInfo, PhysicsScene.Params.collisionMargin);
            PhysicsScene.PE.SetLocalScaling(PhysShape.physShapeInfo, Scale);
            PhysicsScene.PE.SetContactProcessingThreshold(PhysBody, BSParam.ContactProcessingThreshold);
            if (BSParam.CcdMotionThreshold > 0f)
            {
                PhysicsScene.PE.SetCcdMotionThreshold(PhysBody, BSParam.CcdMotionThreshold);
                PhysicsScene.PE.SetCcdSweptSphereRadius(PhysBody, BSParam.CcdSweptSphereRadius);
            }

            UpdatePhysicalMassProperties(RawMass, false);

            // Make so capsule does not fall over
            PhysicsScene.PE.SetAngularFactorV(PhysBody, OMV.Vector3.Zero);

            // The avatar mover sets some parameters.
            PhysicalActors.Refresh();

            PhysicsScene.PE.AddToCollisionFlags(PhysBody, CollisionFlags.CF_CHARACTER_OBJECT);

            PhysicsScene.PE.AddObjectToWorld(PhysicsScene.World, PhysBody);

            // PhysicsScene.PE.ForceActivationState(PhysBody, ActivationState.ACTIVE_TAG);
            PhysicsScene.PE.ForceActivationState(PhysBody, ActivationState.DISABLE_DEACTIVATION);
            PhysicsScene.PE.UpdateSingleAabb(PhysicsScene.World, PhysBody);

            // Do this after the object has been added to the world
            if (BSParam.AvatarToAvatarCollisionsByDefault)
            {
                PhysBody.collisionType = CollisionType.Avatar;
            }
            else
            {
                PhysBody.collisionType = CollisionType.PhantomToOthersAvatar;
            }
            PhysBody.ApplyCollisionMask(PhysicsScene);
        }