예제 #1
0
        /// <summary>
        /// SV_CheckVelocity
        /// </summary>
        static void CheckVelocity(edict_t ent)
        {
            //
            // bound velocity
            //
            if (Mathlib.CheckNaN(ref ent.v.velocity, 0))
            {
                Con.Print("Got a NaN velocity on {0}\n", Progs.GetString(ent.v.classname));
            }

            if (Mathlib.CheckNaN(ref ent.v.origin, 0))
            {
                Con.Print("Got a NaN origin on {0}\n", Progs.GetString(ent.v.classname));
            }

            Vector3 max = Vector3.One * _MaxVelocity.Value;
            Vector3 min = -Vector3.One * _MaxVelocity.Value;

            Mathlib.Clamp(ref ent.v.velocity, ref min, ref max, out ent.v.velocity);
        }