17var
bool autocvar_phys_developer =
false;
18var
float autocvar_phys_pushscale = 1.0f;
19var
float autocvar_phys_impactforcescale = 1.0f;
20var
bool autocvar_phys_lowspec =
true;
21var
float autocvar_phys_spinScale = 1.0f;
22var
float autocvar_phys_forceScale = 1.0f;
25bool physics_supported(
void)
31#define CG_PHYSICS_LOG imageToConsole("gfx/icon16/hourglass", ICN_SIZE, "Client Physics Log")
32#define SV_PHYSICS_LOG imageToConsole("gfx/icon16/hourglass", ICN_SIZE, "Server Physics Log")
35_LogPhysics(
string msg)
38 if (autocvar_g_logTimestamps)
39 print(sprintf(
"%s ^9%f ^7%s\n", CG_PHYSICS_LOG, time, msg));
41 print(sprintf(
"%s ^7%s\n", CG_PHYSICS_LOG, msg));
44 if (autocvar_g_logTimestamps)
45 print(sprintf(
"%s ^9%f ^7%s\n", SV_PHYSICS_LOG, time, msg));
47 print(sprintf(
"%s ^7%s\n", SV_PHYSICS_LOG, msg));
51#define LogPhysics(...) if (autocvar_phys_developer > 0) _ncLog(sprintf(__VA_ARGS__))
55var
bool autocvar_r_showPhysicsInfo =
false;
72 PHYENT_CHANGED_ORIGIN_X,
73 PHYENT_CHANGED_ORIGIN_Y,
74 PHYENT_CHANGED_ORIGIN_Z,
75 PHYENT_CHANGED_ANGLES_X,
76 PHYENT_CHANGED_ANGLES_Y,
77 PHYENT_CHANGED_ANGLES_Z,
78 PHYENT_CHANGED_MODELINDEX,
84 PHYENT_CHANGED_MOVETYPE,
85 PHYENT_CHANGED_EFFECTS,
88 PHYENT_CHANGED_VELOCITY,
89 PHYENT_CHANGED_RENDERCOLOR,
90 PHYENT_CHANGED_RENDERAMT,
91 PHYENT_CHANGED_RENDERMODE,
92} nsphyricsentity_changed_t;
137 virtual void SpawnKey(
string,
string);
142 virtual void Pain(entity, entity,
int, vector, vector,
int);
143 virtual void Death(entity, entity,
int, vector, vector,
int);
146 virtual void Save(
float);
147 virtual void Restore(
string,
string);
148 virtual void Touch(entity);
195 nonvirtual
float GetMass(
void);
233 nonvirtual
void SetMass(
float);
236 nonvirtual
void Wake(
void);
238 nonvirtual
void Sleep(
void);
241 int m_physicsEnabled;
242 int m_desiredGeomtype;
245 float m_inertiaScale;
246 float m_buoyancyRatio;
248 float m_overrideVolume;
249 float m_lastTouchTime;
251 NETWORKED_FLOAT(m_overrideMass)
254 vector m_lastValidSimPos;
255 vector m_lastvalidSimAng;
256 float m_timeSincePhysicsCheck;
257 float m_spawnPhysTime;
258 bool m_playingFeedbackSound;
263 string m_outputOnDamaged;
265 nonvirtual
void PVSCheck(
void);
nonvirtual void ApplyForceCenter(vector)
Call to apply a force (absolute velocity vector) to the center of the entity.
Definition PhysicsEntity.qc:911
virtual void Save(float)
Handles saving a copy of this entity to a given filehandle.
Definition PhysicsEntity.qc:104
nonvirtual bool IsCollisionEnabled(void)
Returns whether the entity is able to collide with anything.
Definition PhysicsEntity.qc:1078
virtual void Pain(entity, entity, int, vector, vector, int)
Called whenever the entity receives damage.
Definition PhysicsEntity.qc:709
nonvirtual float GetSpeedDamping(void)
Returns the speed damping of the entity.
Definition PhysicsEntity.qc:1054
nonvirtual float GetFriction(void)
Returns the friction multiplayer for this entity.
Definition PhysicsEntity.qc:409
nonvirtual float GetLinearDamping(void)
Returns the linear damping of the entity.
Definition PhysicsEntity.qc:990
nonvirtual vector AlignAngles(vector, vector)
Call to align angles of the object to the ones passed.
Definition PhysicsEntity.qc:904
nonvirtual float GetInvMass(void)
Returns 1 divided by the mass of this entity.
Definition PhysicsEntity.qc:1030
nonvirtual float GetMass(void)
Returns the mass of the entity.
Definition PhysicsEntity.qc:1036
nonvirtual float GetRotDamping(void)
Returns the rotational damping of the entity.
Definition PhysicsEntity.qc:1048
nonvirtual float GetSurfaceArea(void)
Returns the surface area of the entity.
Definition PhysicsEntity.qc:1060
nonvirtual float GetEnergy(void)
Returns the linear and rotational kinetic energy combined.
Definition PhysicsEntity.qc:1002
nonvirtual void _UpdateMass(void)
Definition PhysicsEntity.qc:1145
nonvirtual void SetMass(float)
Sets the mass of the entity in kilograms.
Definition PhysicsEntity.qc:1173
nonvirtual void SetBuoyancyRatio(float)
Call to set the buoyancy ratio of the entity.
Definition PhysicsEntity.qc:1120
nonvirtual float GetVolume(void)
Returns the volume of the entity.
Definition PhysicsEntity.qc:1066
virtual float SendEntity(entity, float)
Called by the engine whenever we need to send a client an update about this entity.
Definition PhysicsEntity.qc:212
nonvirtual void Sleep(void)
Call to freeze physics simulation on this entity.
Definition PhysicsEntity.qc:1211
virtual void postdraw(void)
Client: Run after the rendering of 3D world is complete.
nonvirtual void SetFriction(float)
Sets the friction multiplier for this entity.
Definition PhysicsEntity.qc:404
nonvirtual void _UpdateBuoyancy(void)
Definition PhysicsEntity.qc:1156
nonvirtual vector GetMassCenter(void)
Returns the center of mass of the entity.
Definition PhysicsEntity.qc:1042
nonvirtual bool IsPenetrating(void)
Returns whether the entity is penetrating another object.
Definition PhysicsEntity.qc:1108
void ncPhysicsEntity(void)
Definition PhysicsEntity.qc:57
nonvirtual void SetDamping(float, float)
Call to set the linear and angular damping of the entity.
Definition PhysicsEntity.qc:1126
virtual void SetModel(string)
Sets the 3D model representation of the entity from a file path and name.
Definition PhysicsEntity.qc:76
virtual void Spawned(void)
Called when the entity is fulled initialized.
Definition PhysicsEntity.qc:94
virtual void ReceiveEntity(float, float)
Client: Handles network updates from the server for the associated entity.
nonvirtual void SetInertia(float)
Sets the angular inertia for this entity.
Definition PhysicsEntity.qc:1139
nonvirtual bool IsMotionEnabled(void)
Returns whether the entity is able to move by itself.
Definition PhysicsEntity.qc:1096
nonvirtual bool IsDragEnabled(void)
Returns whether the entity is affected by drag.
Definition PhysicsEntity.qc:1084
nonvirtual void SetDragCoefficient(float)
Call to set how much drag affects the entity.
Definition PhysicsEntity.qc:1133
virtual void Restore(string, string)
Similar to ncIO::SpawnKey() but for save-game fields.
Definition PhysicsEntity.qc:115
nonvirtual void ApplyTorqueCenter(vector)
Call to apply torque (angular velocity vector) to the center of the entity.
Definition PhysicsEntity.qc:949
virtual void Touch(entity)
Called whenever we're touching another entity.
Definition PhysicsEntity.qc:448
nonvirtual float GetAngularDamping(void)
Returns the angular damping of the entity.
Definition PhysicsEntity.qc:996
nonvirtual float GetInertia(void)
Returns the inertia modifier of this entity.
Definition PhysicsEntity.qc:1018
nonvirtual void SetAngleDragCoefficient(float)
Call to set the amount of rotational drag the entity experiences.
Definition PhysicsEntity.qc:1114
nonvirtual float GetInvInertia(void)
Returns 1 divided by the angular inertia of this entity.
Definition PhysicsEntity.qc:1024
virtual void Death(entity, entity, int, vector, vector, int)
Called when the health is equal or below 0.
Definition PhysicsEntity.qc:732
nonvirtual float CalculateImpactDamage(int, int)
Called by the physics routine to figure out the impact damage.
Definition PhysicsEntity.qc:416
nonvirtual void EnableGravity(bool)
Call to set whether the entity should be affected by gravity.
Definition PhysicsEntity.qc:973
nonvirtual void Wake(void)
Call to enable physics simulation on this entity.
Definition PhysicsEntity.qc:1180
nonvirtual void EnableMotion(bool)
Call to set whether the entity should be able to move.
Definition PhysicsEntity.qc:980
nonvirtual void ApplyForceOffset(vector, vector)
Call to apply force (absolute velocity vector) to an absolute position on the entity.
Definition PhysicsEntity.qc:930
virtual void EvaluateEntity(void)
Run each tic after physics are run to determine if we need to send updates over the network.
Definition PhysicsEntity.qc:141
virtual void SpawnKey(string, string)
This method handles entity key/value pairs on map load.
Definition PhysicsEntity.qc:857
nonvirtual void EnableDrag(bool)
Call to set whether the entity should be affected by drag.
Definition PhysicsEntity.qc:967
virtual void Respawn(void)
Server: Called when the entity first spawns or when game-logic requests the entity to return to its o...
Definition PhysicsEntity.qc:759
nonvirtual bool IsGravityEnabled(void)
Returns whether the entity is affected by gravity.
Definition PhysicsEntity.qc:1090
nonvirtual bool IsAsleep(void)
Returns whether the entity is at rest and not moving.
Definition PhysicsEntity.qc:1072
nonvirtual bool IsMoveable(void)
Returns whether the entity is able to move.
Definition PhysicsEntity.qc:1102
void ncSurfacePropEntity(void)
Definition SurfacePropEntity.qc:18
noref bool isPhysics
Definition PhysicsEntity.h:269
@ PHYSM_BOX
Entity will explicitly use a box for contact collision detection.
Definition PhysicsEntity.h:115
@ PHYSM_SPHERE
Entity will explicitly use a sphere for contact collision detection.
Definition PhysicsEntity.h:116
@ PHYSM_CYLINDER
Entity will explicitly use a cylinder for contact collision detection.
Definition PhysicsEntity.h:119
@ PHYSM_TRIMESH
Entity will explicitly use a per-poly checks (expensive) for contact collision detection.
Definition PhysicsEntity.h:118
@ PHYSM_CAPSULE
Entity will explicitly use a capsule for contact collision detection.
Definition PhysicsEntity.h:117