Ejemplo n.º 1
0
        public virtual void DoRotation(Rotation idealRotation)
        {
            //
            // Our ideal player model rotation is the way we're facing
            //
            var allowYawDiff = Player.ActiveChild == null ? 120 : 50;

            float turnSpeed = 0.01f;

            if (HasTag("ducked"))
            {
                turnSpeed = 0.1f;
            }

            //
            // If we're moving, rotate to our ideal rotation
            //
            Rot = Rotation.Slerp(Rot, idealRotation, WishVelocity.Length * Time.Delta * turnSpeed);

            //
            // Clamp the foot rotation to within 120 degrees of the ideal rotation
            //
            Rot = Rot.Clamp(idealRotation, allowYawDiff, out var change);

            //
            // If we did restrict, and are standing still, add a foot shuffle
            //
            if (change > 1 && WishVelocity.Length <= 1)
            {
                TimeSinceFootShuffle = 0;
            }

            SetParam("b_shuffle", TimeSinceFootShuffle < 0.1);
        }