Пример #1
0
    public static void SV_CheckVelocity(edict_t ent)
    {
        //
        // bound velocity
        //
        if (Mathlib.CheckNaN(ref ent.v.velocity, 0))
        {
            Con_Printf("Got a NaN velocity on {0}\n", GetString(ent.v.classname));
        }

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

        Vector3 max = Vector3.One * sv_maxvelocity.value;
        Vector3 min = -Vector3.One * sv_maxvelocity.value;

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