Fix CBaseEntity::SetMass

This commit is contained in:
samisalreadytaken 2020-08-31 17:27:54 +03:00
parent 8672b7bb3f
commit d13f2a3e71

View File

@ -2424,14 +2424,13 @@ inline float CBaseEntity::GetMass()
else else
{ {
Warning("Tried to call GetMass() on %s but it has no physics.\n", GetDebugName()); Warning("Tried to call GetMass() on %s but it has no physics.\n", GetDebugName());
return -1; return 0;
} }
} }
inline void CBaseEntity::SetMass(float mass) inline void CBaseEntity::SetMass(float mass)
{ {
mass = MAX(0, mass); mass = clamp(mass, VPHYSICS_MIN_MASS, VPHYSICS_MAX_MASS);
Assert(mass > 0);
IPhysicsObject *vPhys = VPhysicsGetObject(); IPhysicsObject *vPhys = VPhysicsGetObject();
if (vPhys) if (vPhys)