Nuclide
Software Development Kit for id Technology (BETA)
ncPhysicsEntity Class Reference

About this class

This entity class represents physically-simulated entities.

Units of mass is defined in kilograms, a standard unit of measurement. You will find the API to be mostly compatible of that offered by Garry's Mod.

Inheritance diagram for ncPhysicsEntity:
ncSurfacePropEntity func_physbox ncDebris ncItem prop_physics prop_static ncWeapon

Public Member Functions

void ncPhysicsEntity (void)
 
virtual void Respawn (void)
 Server: Called when the entity first spawns or when game-logic requests the entity to return to its original spawn state. More...
 
virtual void SpawnKey (string, string)
 This method handles entity key/value pairs on map load. More...
 
virtual void SetModel (string)
 Sets the 3D model representation of the entity from a file path and name. More...
 
virtual void Spawned (void)
 Called when the entity is fulled initialized. More...
 
virtual void Pain (entity, entity, int, vector, vector, int)
 Called whenever the entity receives damage. More...
 
virtual void Death (entity, entity, int, vector, vector, int)
 Called when the health is equal or below 0. More...
 
virtual void EvaluateEntity (void)
 Run each tic after physics are run to determine if we need to send updates over the network. More...
 
virtual float SendEntity (entity, float)
 Called by the engine whenever we need to send a client an update about this entity. More...
 
virtual void Save (float)
 Handles saving a copy of this entity to a given filehandle. More...
 
virtual void Restore (string, string)
 Similar to ncIO::SpawnKey() but for save-game fields. More...
 
virtual void Touch (entity)
 Called whenever we're touching another entity. More...
 
virtual void ReceiveEntity (float, float)
 Client: Handles network updates from the server for the associated entity. More...
 
virtual void postdraw (void)
 Client: Run after the rendering of 3D world is complete. More...
 
nonvirtual void _UpdateBuoyancy (void)
 
nonvirtual void _UpdateMass (void)
 
nonvirtual void SetFriction (float)
 Sets the friction multiplier for this entity. More...
 
nonvirtual float GetFriction (void)
 Returns the friction multiplayer for this entity. More...
 
nonvirtual float CalculateImpactDamage (int, int)
 Called by the physics routine to figure out the impact damage. More...
 
nonvirtual vector AlignAngles (vector, vector)
 Call to align angles of the object to the ones passed. More...
 
nonvirtual void ApplyForceCenter (vector)
 Call to apply a force (absolute velocity vector) to the center of the entity. More...
 
nonvirtual void ApplyForceOffset (vector, vector)
 Call to apply force (absolute velocity vector) to an absolute position on the entity. More...
 
nonvirtual void ApplyTorqueCenter (vector)
 Call to apply torque (angular velocity vector) to the center of the entity. More...
 
nonvirtual void EnableDrag (bool)
 Call to set whether the entity should be affected by drag. More...
 
nonvirtual void EnableGravity (bool)
 Call to set whether the entity should be affected by gravity. More...
 
nonvirtual void EnableMotion (bool)
 Call to set whether the entity should be able to move. More...
 
nonvirtual float GetLinearDamping (void)
 Returns the linear damping of the entity. More...
 
nonvirtual float GetAngularDamping (void)
 Returns the angular damping of the entity. More...
 
nonvirtual float GetEnergy (void)
 Returns the linear and rotational kinetic energy combined. More...
 
nonvirtual float GetInertia (void)
 Returns the inertia modifier of this entity. More...
 
nonvirtual float GetInvInertia (void)
 Returns 1 divided by the angular inertia of this entity. More...
 
nonvirtual float GetInvMass (void)
 Returns 1 divided by the mass of this entity. More...
 
nonvirtual float GetMass (void)
 Returns the mass of the entity. More...
 
nonvirtual vector GetMassCenter (void)
 Returns the center of mass of the entity. More...
 
nonvirtual float GetRotDamping (void)
 Returns the rotational damping of the entity. More...
 
nonvirtual float GetSpeedDamping (void)
 Returns the speed damping of the entity. More...
 
nonvirtual float GetSurfaceArea (void)
 Returns the surface area of the entity. More...
 
nonvirtual float GetVolume (void)
 Returns the volume of the entity. More...
 
nonvirtual bool IsAsleep (void)
 Returns whether the entity is at rest and not moving. More...
 
nonvirtual bool IsCollisionEnabled (void)
 Returns whether the entity is able to collide with anything. More...
 
nonvirtual bool IsDragEnabled (void)
 Returns whether the entity is affected by drag. More...
 
nonvirtual bool IsGravityEnabled (void)
 Returns whether the entity is affected by gravity. More...
 
nonvirtual bool IsMotionEnabled (void)
 Returns whether the entity is able to move by itself. More...
 
nonvirtual bool IsMoveable (void)
 Returns whether the entity is able to move. More...
 
nonvirtual bool IsPenetrating (void)
 Returns whether the entity is penetrating another object. More...
 
nonvirtual void SetAngleDragCoefficient (float)
 Call to set the amount of rotational drag the entity experiences. More...
 
nonvirtual void SetBuoyancyRatio (float)
 Call to set the buoyancy ratio of the entity. More...
 
nonvirtual void SetDamping (float, float)
 Call to set the linear and angular damping of the entity. More...
 
nonvirtual void SetDragCoefficient (float)
 Call to set how much drag affects the entity. More...
 
nonvirtual void SetInertia (float)
 Sets the angular inertia for this entity. More...
 
nonvirtual void SetMass (float)
 Sets the mass of the entity in kilograms. More...
 
nonvirtual void Wake (void)
 Call to enable physics simulation on this entity. More...
 
nonvirtual void Sleep (void)
 Call to freeze physics simulation on this entity. More...
 

Constructor & Destructor Documentation

◆ ncPhysicsEntity()

void ncPhysicsEntity::ncPhysicsEntity ( void  )

Member Function Documentation

◆ _UpdateBuoyancy()

void ncPhysicsEntity::_UpdateBuoyancy ( void  )

◆ _UpdateMass()

void ncPhysicsEntity::_UpdateMass ( void  )

◆ AlignAngles()

vector ncPhysicsEntity::AlignAngles ( vector  from,
vector  to 
)

Call to align angles of the object to the ones passed.

◆ ApplyForceCenter()

void ncPhysicsEntity::ApplyForceCenter ( vector  vecForce)

Call to apply a force (absolute velocity vector) to the center of the entity.

◆ ApplyForceOffset()

void ncPhysicsEntity::ApplyForceOffset ( vector  vecForce,
vector  vecOffset 
)

Call to apply force (absolute velocity vector) to an absolute position on the entity.

◆ ApplyTorqueCenter()

void ncPhysicsEntity::ApplyTorqueCenter ( vector  vecTorque)

Call to apply torque (angular velocity vector) to the center of the entity.

◆ CalculateImpactDamage()

float ncPhysicsEntity::CalculateImpactDamage ( int  iDamage,
int  dmgType 
)

Called by the physics routine to figure out the impact damage.

◆ Death()

void ncPhysicsEntity::Death ( entity  inflictor,
entity  attacker,
int  damage,
vector  dir,
vector  absImpactPos,
int  hitBody 
)
virtual

Called when the health is equal or below 0.

Reimplemented from ncSurfacePropEntity.

◆ EnableDrag()

void ncPhysicsEntity::EnableDrag ( bool  setEnabled)

Call to set whether the entity should be affected by drag.

◆ EnableGravity()

void ncPhysicsEntity::EnableGravity ( bool  setEnabled)

Call to set whether the entity should be affected by gravity.

◆ EnableMotion()

void ncPhysicsEntity::EnableMotion ( bool  setEnabled)

Call to set whether the entity should be able to move.

◆ EvaluateEntity()

void ncPhysicsEntity::EvaluateEntity ( void  )
virtual

Run each tic after physics are run to determine if we need to send updates over the network.

Reimplemented from ncSurfacePropEntity.

Reimplemented in ncItem, and ncWeapon.

◆ GetAngularDamping()

float ncPhysicsEntity::GetAngularDamping ( void  )

Returns the angular damping of the entity.

◆ GetEnergy()

float ncPhysicsEntity::GetEnergy ( void  )

Returns the linear and rotational kinetic energy combined.

◆ GetFriction()

float ncPhysicsEntity::GetFriction ( void  )

Returns the friction multiplayer for this entity.

◆ GetInertia()

float ncPhysicsEntity::GetInertia ( void  )

Returns the inertia modifier of this entity.

◆ GetInvInertia()

float ncPhysicsEntity::GetInvInertia ( void  )

Returns 1 divided by the angular inertia of this entity.

◆ GetInvMass()

float ncPhysicsEntity::GetInvMass ( void  )

Returns 1 divided by the mass of this entity.

◆ GetLinearDamping()

float ncPhysicsEntity::GetLinearDamping ( void  )

Returns the linear damping of the entity.

◆ GetMass()

float ncPhysicsEntity::GetMass ( void  )

Returns the mass of the entity.

◆ GetMassCenter()

vector ncPhysicsEntity::GetMassCenter ( void  )

Returns the center of mass of the entity.

◆ GetRotDamping()

float ncPhysicsEntity::GetRotDamping ( void  )

Returns the rotational damping of the entity.

◆ GetSpeedDamping()

float ncPhysicsEntity::GetSpeedDamping ( void  )

Returns the speed damping of the entity.

◆ GetSurfaceArea()

float ncPhysicsEntity::GetSurfaceArea ( void  )

Returns the surface area of the entity.

◆ GetVolume()

float ncPhysicsEntity::GetVolume ( void  )

Returns the volume of the entity.

◆ IsAsleep()

bool ncPhysicsEntity::IsAsleep ( void  )

Returns whether the entity is at rest and not moving.

◆ IsCollisionEnabled()

bool ncPhysicsEntity::IsCollisionEnabled ( void  )

Returns whether the entity is able to collide with anything.

◆ IsDragEnabled()

bool ncPhysicsEntity::IsDragEnabled ( void  )

Returns whether the entity is affected by drag.

◆ IsGravityEnabled()

bool ncPhysicsEntity::IsGravityEnabled ( void  )

Returns whether the entity is affected by gravity.

◆ IsMotionEnabled()

bool ncPhysicsEntity::IsMotionEnabled ( void  )

Returns whether the entity is able to move by itself.

◆ IsMoveable()

bool ncPhysicsEntity::IsMoveable ( void  )

Returns whether the entity is able to move.

◆ IsPenetrating()

bool ncPhysicsEntity::IsPenetrating ( void  )

Returns whether the entity is penetrating another object.

◆ Pain()

void ncPhysicsEntity::Pain ( entity  inflictor,
entity  attacker,
int  damage,
vector  dir,
vector  absImpactPos,
int  hitBody 
)
virtual

Called whenever the entity receives damage.

Reimplemented from ncSurfacePropEntity.

◆ postdraw()

virtual void ncPhysicsEntity::postdraw ( void  )
virtual

Client: Run after the rendering of 3D world is complete.

2D calls can happen here.

Reimplemented from ncRenderableEntity.

◆ ReceiveEntity()

virtual void ncPhysicsEntity::ReceiveEntity ( float  flNew,
float  flChanged 
)
virtual

Client: Handles network updates from the server for the associated entity.

Reimplemented from ncSurfacePropEntity.

Reimplemented in ncItem, and ncWeapon.

◆ Respawn()

void ncPhysicsEntity::Respawn ( void  )
virtual

Server: Called when the entity first spawns or when game-logic requests the entity to return to its original spawn state.

Reimplemented from ncSurfacePropEntity.

Reimplemented in prop_static, func_physbox, prop_physics, prop_static, and ncItem.

◆ Restore()

void ncPhysicsEntity::Restore ( string  strKey,
string  strValue 
)
virtual

Similar to ncIO::SpawnKey() but for save-game fields.

Whatever you write into file handles within your ncIO::Save() method needs to be read back in here.

Reimplemented from ncSurfacePropEntity.

Reimplemented in ncItem, and ncWeapon.

◆ Save()

void ncPhysicsEntity::Save ( float  handle)
virtual

Handles saving a copy of this entity to a given filehandle.

Within you want to use the ncIO::SaveFloat() etc. methods to write the internal member attributes to the specified file handle.

Reimplemented from ncSurfacePropEntity.

Reimplemented in ncItem, and ncWeapon.

◆ SendEntity()

float ncPhysicsEntity::SendEntity ( entity  ,
float   
)
virtual

Called by the engine whenever we need to send a client an update about this entity.

Reimplemented from ncSurfacePropEntity.

Reimplemented in ncItem, and ncWeapon.

◆ SetAngleDragCoefficient()

void ncPhysicsEntity::SetAngleDragCoefficient ( float  setValue)

Call to set the amount of rotational drag the entity experiences.

◆ SetBuoyancyRatio()

void ncPhysicsEntity::SetBuoyancyRatio ( float  setValue)

Call to set the buoyancy ratio of the entity.

0 is not buoyant, 1 is very buoyant.

◆ SetDamping()

void ncPhysicsEntity::SetDamping ( float  linearDamp,
float  angleDamp 
)

Call to set the linear and angular damping of the entity.

◆ SetDragCoefficient()

void ncPhysicsEntity::SetDragCoefficient ( float  dragValue)

Call to set how much drag affects the entity.

◆ SetFriction()

void ncPhysicsEntity::SetFriction ( float  val)

Sets the friction multiplier for this entity.

Default is 1.0

◆ SetInertia()

void ncPhysicsEntity::SetInertia ( float  val)

Sets the angular inertia for this entity.

◆ SetMass()

void ncPhysicsEntity::SetMass ( float  val)

Sets the mass of the entity in kilograms.

◆ SetModel()

void ncPhysicsEntity::SetModel ( string  newModel)
virtual

Sets the 3D model representation of the entity from a file path and name.

Reimplemented from ncSurfacePropEntity.

◆ Sleep()

void ncPhysicsEntity::Sleep ( void  )

Call to freeze physics simulation on this entity.

◆ Spawned()

void ncPhysicsEntity::Spawned ( void  )
virtual

Called when the entity is fulled initialized.

Any spawn key/value info pairs have already been dealt with. So now we can make full decisions on the entity. Always make sure to call super::Spawned(); inside your method when overriding.

Reimplemented from ncSurfacePropEntity.

Reimplemented in prop_static, ncItem, and ncWeapon.

◆ SpawnKey()

void ncPhysicsEntity::SpawnKey ( string  strKey,
string  strValue 
)
virtual

This method handles entity key/value pairs on map load.

You can easily convert the strValue parameter using the ReadFloat etc. methods that are part of ncIO.

Reimplemented from ncSurfacePropEntity.

Reimplemented in prop_static, func_physbox, prop_physics, ncItem, and ncWeapon.

◆ Touch()

void ncPhysicsEntity::Touch ( entity  eToucher)
virtual

Called whenever we're touching another entity.

Reimplemented from ncTrigger.

Reimplemented in ncDebris, and ncItem.

◆ Wake()

void ncPhysicsEntity::Wake ( void  )

Call to enable physics simulation on this entity.


The documentation for this class was generated from the following files: