17var
bool autocvar_phys_developer =
false;
19_NSPhysics_Log(
string msg)
21 if (autocvar_phys_developer ==
true)
22 print(sprintf(
"%f %s\n", time, msg));
24#define NSPhysics_Log(...) _NSPhysics_Log(sprintf(__VA_ARGS__))
27var
float autocvar_phys_pushscale = 1.0f;
28var
float autocvar_phys_impactforcescale = 1.0f;
31var
bool autocvar_r_showPhysicsInfo =
false;
48 PHYENT_CHANGED_ORIGIN_X,
49 PHYENT_CHANGED_ORIGIN_Y,
50 PHYENT_CHANGED_ORIGIN_Z,
51 PHYENT_CHANGED_ANGLES_X,
52 PHYENT_CHANGED_ANGLES_Y,
53 PHYENT_CHANGED_ANGLES_Z,
54 PHYENT_CHANGED_MODELINDEX,
60 PHYENT_CHANGED_MOVETYPE,
61 PHYENT_CHANGED_EFFECTS,
64 PHYENT_CHANGED_VELOCITY,
65 PHYENT_CHANGED_RENDERCOLOR,
66 PHYENT_CHANGED_RENDERAMT,
67 PHYENT_CHANGED_RENDERMODE,
68} nsphyricsentity_changed_t;
112 virtual void SpawnKey(
string,
string);
117 virtual void Pain(entity, entity,
int, vector, vector,
int);
118 virtual void Death(entity, entity,
int, vector, vector,
int);
121 virtual void Save(
float);
122 virtual void Restore(
string,
string);
123 virtual void Touch(entity);
169 nonvirtual
float GetMass(
void);
207 nonvirtual
void SetMass(
float);
210 nonvirtual
void Wake(
void);
212 nonvirtual
void Sleep(
void);
219 float m_flInertiaScale;
220 float m_flBuoyancyRatio;
223 float m_lastTouchTime;
226 vector m_vecPrevOrigin;
227 vector m_vecPrevAngles;
229 PREDICTED_FLOAT(m_flMass)
230 float m_flEnabledTime;
231 float m_spawnPhysTime;
234 PREDICTED_VECTOR(m_vecNetAngles)
236 string m_strOnDamaged;
This entity class represents physically-simulated entities.
Definition: NSPhysicsEntity.h:106
virtual float SendEntity(entity, float)
Called by the engine whenever we need to send a client an update about this entity.
Definition: NSPhysicsEntity.qc:220
virtual void Touch(entity)
Called whenever we're touching another entity.
Definition: NSPhysicsEntity.qc:450
nonvirtual bool IsDragEnabled(void)
Returns whether the entity is affected by drag.
Definition: NSPhysicsEntity.qc:1038
nonvirtual float GetVolume(void)
Returns the volume of the entity.
Definition: NSPhysicsEntity.qc:1020
nonvirtual vector AlignAngles(vector, vector)
Call to align angles of the object to the ones passed.
Definition: NSPhysicsEntity.qc:858
nonvirtual float GetRotDamping(void)
Returns the rotational damping of the entity.
Definition: NSPhysicsEntity.qc:1002
nonvirtual void SetFriction(float)
Sets the friction multiplier for this entity.
Definition: NSPhysicsEntity.qc:406
nonvirtual bool IsPenetrating(void)
Returns whether the entity is penetrating another object.
Definition: NSPhysicsEntity.qc:1062
nonvirtual bool IsGravityEnabled(void)
Returns whether the entity is affected by gravity.
Definition: NSPhysicsEntity.qc:1044
nonvirtual void ApplyTorqueCenter(vector)
Call to apply torque (angular velocity vector) to the center of the entity.
Definition: NSPhysicsEntity.qc:903
virtual void postdraw(void)
Client: Run after the rendering of 3D world is complete.
nonvirtual float GetInertia(void)
Returns the inertia modifier of this entity.
Definition: NSPhysicsEntity.qc:972
nonvirtual bool IsMoveable(void)
Returns whether the entity is able to move.
Definition: NSPhysicsEntity.qc:1056
nonvirtual float GetInvInertia(void)
Returns 1 divided by the angular inertia of this entity.
Definition: NSPhysicsEntity.qc:978
nonvirtual float GetSurfaceArea(void)
Returns the surface area of the entity.
Definition: NSPhysicsEntity.qc:1014
nonvirtual float GetMass(void)
Returns the mass of the entity.
Definition: NSPhysicsEntity.qc:990
virtual void SetModel(string)
Sets the 3D model representation of the entity from a file path and name.
Definition: NSPhysicsEntity.qc:72
nonvirtual bool IsMotionEnabled(void)
Returns whether the entity is able to move by itself.
Definition: NSPhysicsEntity.qc:1050
virtual void ReceiveEntity(float, float)
Client: Handles network updates from the server for the associated entity.
nonvirtual float GetEnergy(void)
Returns the linear and rotational kinetic energy combined.
Definition: NSPhysicsEntity.qc:956
virtual void Pain(entity, entity, int, vector, vector, int)
Called whenever the entity receives damage.
Definition: NSPhysicsEntity.qc:698
nonvirtual void SetAngleDragCoefficient(float)
Call to set the amount of rotational drag the entity experiences.
Definition: NSPhysicsEntity.qc:1068
nonvirtual float GetSpeedDamping(void)
Returns the speed damping of the entity.
Definition: NSPhysicsEntity.qc:1008
nonvirtual void EnableGravity(bool)
Call to set whether the entity should be affected by gravity.
Definition: NSPhysicsEntity.qc:927
virtual void Respawn(void)
Server: Called when the entity first spawns or when game-logic requests the entity to return to its o...
Definition: NSPhysicsEntity.qc:747
nonvirtual float GetAngularDamping(void)
Returns the angular damping of the entity.
Definition: NSPhysicsEntity.qc:950
nonvirtual void SetMass(float)
Sets the mass of the entity in kilograms.
Definition: NSPhysicsEntity.qc:1127
nonvirtual bool IsCollisionEnabled(void)
Returns whether the entity is able to collide with anything.
Definition: NSPhysicsEntity.qc:1032
nonvirtual void _UpdateBuoyancy(void)
Definition: NSPhysicsEntity.qc:1110
nonvirtual void SetDragCoefficient(float)
Call to set how much drag affects the entity.
Definition: NSPhysicsEntity.qc:1087
nonvirtual float GetFriction(void)
Returns the friction multiplayer for this entity.
Definition: NSPhysicsEntity.qc:411
virtual void Save(float)
Handles saving a copy of this entity to a given filehandle.
Definition: NSPhysicsEntity.qc:100
nonvirtual void EnableMotion(bool)
Call to set whether the entity should be able to move.
Definition: NSPhysicsEntity.qc:934
nonvirtual void SetInertia(float)
Sets the angular inertia for this entity.
Definition: NSPhysicsEntity.qc:1093
nonvirtual float GetLinearDamping(void)
Returns the linear damping of the entity.
Definition: NSPhysicsEntity.qc:944
nonvirtual vector GetMassCenter(void)
Returns the center of mass of the entity.
Definition: NSPhysicsEntity.qc:996
nonvirtual void ApplyForceCenter(vector)
Call to apply a force (absolute velocity vector) to the center of the entity.
Definition: NSPhysicsEntity.qc:865
virtual void Restore(string, string)
Similar to NSIO::SpawnKey but for save-game fields.
Definition: NSPhysicsEntity.qc:112
nonvirtual float GetInvMass(void)
Returns 1 divided by the mass of this entity.
Definition: NSPhysicsEntity.qc:984
nonvirtual void SetDamping(float, float)
Call to set the linear and angular damping of the entity.
Definition: NSPhysicsEntity.qc:1080
nonvirtual void Wake(void)
Call to enable physics simulation on this entity.
Definition: NSPhysicsEntity.qc:1134
nonvirtual float CalculateImpactDamage(int, int)
Called by the physics routine to figure out the impact damage.
Definition: NSPhysicsEntity.qc:418
void NSPhysicsEntity(void)
Definition: NSPhysicsEntity.qc:52
nonvirtual void ApplyForceOffset(vector, vector)
Call to apply force (absolute velocity vector) to an absolute position on the entity.
Definition: NSPhysicsEntity.qc:884
virtual void Spawned(void)
Called when the entity is fulled initialized.
Definition: NSPhysicsEntity.qc:90
nonvirtual void Sleep(void)
Call to freeze physics simulation on this entity.
Definition: NSPhysicsEntity.qc:1169
virtual void EvaluateEntity(void)
Run each tic after physics are run to determine if we need to send updates over the network.
Definition: NSPhysicsEntity.qc:149
nonvirtual void SetBuoyancyRatio(float)
Call to set the buoyancy ratio of the entity.
Definition: NSPhysicsEntity.qc:1074
nonvirtual void EnableDrag(bool)
Call to set whether the entity should be affected by drag.
Definition: NSPhysicsEntity.qc:921
virtual void Death(entity, entity, int, vector, vector, int)
Called when the health is equal or below 0.
Definition: NSPhysicsEntity.qc:723
nonvirtual bool IsAsleep(void)
Returns whether the entity is at rest and not moving.
Definition: NSPhysicsEntity.qc:1026
nonvirtual void _UpdateMass(void)
Definition: NSPhysicsEntity.qc:1099
virtual void SpawnKey(string, string)
This method handles entity key/value pairs on map load.
Definition: NSPhysicsEntity.qc:811
This entity represents an NSRenderableEntity with interactive surface properties.
Definition: NSSurfacePropEntity.h:52
typedef enumflags
Defines the valid alignment flags for text fields.
Definition: font.h:37
noref bool isPhysics
Definition: NSPhysicsEntity.h:240
@ PHYSM_BOX
Definition: NSPhysicsEntity.h:90
@ PHYSM_SPHERE
Definition: NSPhysicsEntity.h:91
@ PHYSM_CYLINDER
Definition: NSPhysicsEntity.h:94
@ PHYSM_TRIMESH
Definition: NSPhysicsEntity.h:93
@ PHYSM_CAPSULE
Definition: NSPhysicsEntity.h:92