Nuclide
Software Development Kit for id Tech
NSPhysicsConstraint Class Reference

This entity class represents constraints for physically-simulated entities. More...

#include <NSPhysicsConstraint.h>

Inheritance diagram for NSPhysicsConstraint:
NSEntity phys_ballsocket phys_constraint phys_constraintsystem phys_convert phys_hinge phys_keepupright phys_slideconstraint

Public Member Functions

void NSPhysicsConstraint (void)
 
virtual void SpawnKey (string, string)
 This method handles entity key/value pairs on map load. More...
 
virtual void Save (float)
 Handles saving a copy of this entity to a given filehandle. More...
 
virtual void Restore (string, string)
 Similar to ::SpawnKey but for save-game fields. More...
 
virtual void Input (entity, string, string)
 Called when we are being prompted by another object/function with an input message. More...
 
virtual void Spawned (void)
 Called when the entity is fulled initialized. More...
 
virtual void OnRemoveEntity (void)
 Handles what happens before the entity gets removed from the client game. More...
 
nonvirtual void WakeTargets (void)
 Awakes the entities this constraint is connected to. More...
 
nonvirtual void Break (entity)
 Breaks the constraint. More...
 
nonvirtual constraint_t GetConstraintType (void)
 Returns the type of this constraint entity. More...
 
nonvirtual entity GetEntity1 (void)
 Returns the first entity connection. More...
 
nonvirtual entity GetEntity2 (void)
 Returns the second entity connection. More...
 
nonvirtual void SetConstraintType (constraint_t)
 Will override the constraint type this entity represents. More...
 
nonvirtual void SetEntity1 (entity)
 Sets the first entity in the connection. More...
 
nonvirtual void SetEntity2 (entity)
 Sets the second entity in the connection. More...
 
nonvirtual void SetSliderVelocity (float)
 Sets the velocity on a CONSTRAINT_SLIDER type NSPhysicsConstraint. More...
 
nonvirtual void SetSliderMaxVelocity (float)
 Sets the max velocity on a CONSTRAINT_SLIDER type NSPhysicsConstraint. More...
 
nonvirtual void SetSliderStop (float)
 Sets the maximum travel distance of the slider. More...
 
nonvirtual void SetSliderFriction (float)
 Sets the friction of the slider. More...
 
nonvirtual float GetSliderVelocity (void)
 Returns the velocity of a CONSTRAINT_SLIDER type NSPhysicsConstraint. More...
 
nonvirtual float GetSliderMaxVelocity (void)
 Returns the max velocity of a CONSTRAINT_SLIDER type NSPhysicsConstraint. More...
 
nonvirtual float GetSliderStop (void)
 Returns the maximum travel distance of the slider. More...
 
nonvirtual float GetSliderFriction (void)
 Returns the friction of the slider. More...
 
nonvirtual float GetConstraintSystemID (void)
 Returns the unique joint group ID associated with a phys_constraintsystem. More...
 
nonvirtual NSPhysicsConstraint Ballsocket (entity, entity, vector, vector, float, bool)
 Creates a ballsocket constraint and returns it. More...
 
nonvirtual NSPhysicsConstraint Weld (entity, entity, float, float, float, bool, bool)
 Creates a ballsocket constraint and returns it. More...
 
nonvirtual NSPhysicsConstraint Rope (entity, entity, vector, vector)
 Creates a ballsocket constraint and returns it. More...
 
nonvirtual NSPhysicsConstraint KeepUpright (entity, vector, float)
 
nonvirtual void ConstraintThink (void)
 

Detailed Description

This entity class represents constraints for physically-simulated entities.

If you want to create an easy 'weld' type connection, a ballsocket or even a rope type connection - this class is what you need.

Constructor & Destructor Documentation

◆ NSPhysicsConstraint()

void NSPhysicsConstraint::NSPhysicsConstraint ( void  )

Member Function Documentation

◆ Ballsocket()

NSPhysicsConstraint NSPhysicsConstraint::Ballsocket ( entity  firstEnt,
entity  secondEnt,
vector  pos1,
vector  pos2,
float  forceLimit,
bool  noCollide 
)

Creates a ballsocket constraint and returns it.

◆ Break()

void NSPhysicsConstraint::Break ( entity  activatingEnt)

Breaks the constraint.

◆ ConstraintThink()

void NSPhysicsConstraint::ConstraintThink ( void  )

◆ GetConstraintSystemID()

float NSPhysicsConstraint::GetConstraintSystemID ( void  )

Returns the unique joint group ID associated with a phys_constraintsystem.

◆ GetConstraintType()

constraint_t NSPhysicsConstraint::GetConstraintType ( void  )

Returns the type of this constraint entity.

◆ GetEntity1()

entity NSPhysicsConstraint::GetEntity1 ( void  )

Returns the first entity connection.

Should not return world/__NULL__

◆ GetEntity2()

entity NSPhysicsConstraint::GetEntity2 ( void  )

Returns the second entity connection.

Can also return world/__NULL__

◆ GetSliderFriction()

float NSPhysicsConstraint::GetSliderFriction ( void  )

Returns the friction of the slider.

◆ GetSliderMaxVelocity()

float NSPhysicsConstraint::GetSliderMaxVelocity ( void  )

Returns the max velocity of a CONSTRAINT_SLIDER type NSPhysicsConstraint.

◆ GetSliderStop()

float NSPhysicsConstraint::GetSliderStop ( void  )

Returns the maximum travel distance of the slider.

◆ GetSliderVelocity()

float NSPhysicsConstraint::GetSliderVelocity ( void  )

Returns the velocity of a CONSTRAINT_SLIDER type NSPhysicsConstraint.

◆ Input()

void NSPhysicsConstraint::Input ( entity  eAct,
string  strInput,
string  strData 
)
virtual

Called when we are being prompted by another object/function with an input message.

Reimplemented from NSEntity.

Reimplemented in phys_convert, phys_hinge, phys_keepupright, and phys_slideconstraint.

◆ KeepUpright()

NSPhysicsConstraint NSPhysicsConstraint::KeepUpright ( entity  firstEnt,
vector  uprightAngle,
float  angleLimit 
)

◆ OnRemoveEntity()

void NSPhysicsConstraint::OnRemoveEntity ( void  )
virtual

Handles what happens before the entity gets removed from the client game.

Reimplemented from NSEntity.

◆ Restore()

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

Similar to ::SpawnKey but for save-game fields.

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

Reimplemented from NSEntity.

Reimplemented in phys_convert, phys_hinge, phys_keepupright, and phys_slideconstraint.

◆ Rope()

NSPhysicsConstraint NSPhysicsConstraint::Rope ( entity  firstEnt,
entity  secondEnt,
vector  pos1,
vector  pos2 
)

Creates a ballsocket constraint and returns it.

◆ Save()

void NSPhysicsConstraint::Save ( float  handle)
virtual

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

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

Reimplemented from NSEntity.

Reimplemented in phys_convert, phys_hinge, phys_keepupright, and phys_slideconstraint.

◆ SetConstraintType()

void NSPhysicsConstraint::SetConstraintType ( constraint_t  setValue)

Will override the constraint type this entity represents.

See constraint_t for choices.

◆ SetEntity1()

void NSPhysicsConstraint::SetEntity1 ( entity  targetEnt)

Sets the first entity in the connection.

Needs to be set.

◆ SetEntity2()

void NSPhysicsConstraint::SetEntity2 ( entity  targetEnt)

Sets the second entity in the connection.

Can be world.

◆ SetSliderFriction()

void NSPhysicsConstraint::SetSliderFriction ( float  frictionValue)

Sets the friction of the slider.

◆ SetSliderMaxVelocity()

void NSPhysicsConstraint::SetSliderMaxVelocity ( float  maxVel)

Sets the max velocity on a CONSTRAINT_SLIDER type NSPhysicsConstraint.

◆ SetSliderStop()

void NSPhysicsConstraint::SetSliderStop ( float  stopVal)

Sets the maximum travel distance of the slider.

◆ SetSliderVelocity()

void NSPhysicsConstraint::SetSliderVelocity ( float  slideVel)

Sets the velocity on a CONSTRAINT_SLIDER type NSPhysicsConstraint.

◆ Spawned()

void NSPhysicsConstraint::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 NSEntity.

Reimplemented in phys_convert.

◆ SpawnKey()

void NSPhysicsConstraint::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 NSIO.

Reimplemented from NSEntity.

Reimplemented in phys_convert, phys_hinge, phys_keepupright, and phys_slideconstraint.

◆ WakeTargets()

void NSPhysicsConstraint::WakeTargets ( void  )

Awakes the entities this constraint is connected to.

◆ Weld()

NSPhysicsConstraint NSPhysicsConstraint::Weld ( entity  firstEnt,
entity  secondEnt,
float  bone1,
float  bone2,
float  forceLimit,
bool  noCollide,
bool  deleteEnt1OnBreak 
)

Creates a ballsocket constraint and returns it.


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