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

About this class

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.

Inheritance diagram for ncPhysicsConstraint:
ncEntity phys_ballsocket phys_constraint phys_constraintsystem phys_convert phys_hinge phys_keepupright phys_slideconstraint

Public Member Functions

void ncPhysicsConstraint (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 ncIO::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 ncPhysicsConstraint. More...
 
nonvirtual void SetSliderMaxVelocity (float)
 Sets the max velocity on a CONSTRAINT_SLIDER type ncPhysicsConstraint. 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 ncPhysicsConstraint. More...
 
nonvirtual float GetSliderMaxVelocity (void)
 Returns the max velocity of a CONSTRAINT_SLIDER type ncPhysicsConstraint. 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 ncPhysicsConstraint Ballsocket (entity, entity, vector, vector, float, bool)
 Creates a ballsocket constraint and returns it. More...
 
nonvirtual ncPhysicsConstraint Weld (entity, entity, float, float, float, bool, bool)
 Creates a ballsocket constraint and returns it. More...
 
nonvirtual ncPhysicsConstraint Rope (entity, entity, vector, vector)
 Creates a ballsocket constraint and returns it. More...
 
nonvirtual ncPhysicsConstraint KeepUpright (entity, vector, float)
 
nonvirtual void ConstraintThink (void)
 

Constructor & Destructor Documentation

◆ ncPhysicsConstraint()

void ncPhysicsConstraint::ncPhysicsConstraint ( void  )

Member Function Documentation

◆ Ballsocket()

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

Creates a ballsocket constraint and returns it.

◆ Break()

void ncPhysicsConstraint::Break ( entity  activatingEnt)

Breaks the constraint.

◆ ConstraintThink()

void ncPhysicsConstraint::ConstraintThink ( void  )

◆ GetConstraintSystemID()

float ncPhysicsConstraint::GetConstraintSystemID ( void  )

Returns the unique joint group ID associated with a phys_constraintsystem.

◆ GetConstraintType()

constraint_t ncPhysicsConstraint::GetConstraintType ( void  )

Returns the type of this constraint entity.

◆ GetEntity1()

entity ncPhysicsConstraint::GetEntity1 ( void  )

Returns the first entity connection.

Should not return world/__NULL__

◆ GetEntity2()

entity ncPhysicsConstraint::GetEntity2 ( void  )

Returns the second entity connection.

Can also return world/__NULL__

◆ GetSliderFriction()

float ncPhysicsConstraint::GetSliderFriction ( void  )

Returns the friction of the slider.

◆ GetSliderMaxVelocity()

float ncPhysicsConstraint::GetSliderMaxVelocity ( void  )

Returns the max velocity of a CONSTRAINT_SLIDER type ncPhysicsConstraint.

◆ GetSliderStop()

float ncPhysicsConstraint::GetSliderStop ( void  )

Returns the maximum travel distance of the slider.

◆ GetSliderVelocity()

float ncPhysicsConstraint::GetSliderVelocity ( void  )

Returns the velocity of a CONSTRAINT_SLIDER type ncPhysicsConstraint.

◆ Input()

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

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

Reimplemented from ncEntity.

Reimplemented in phys_convert, phys_hinge, phys_keepupright, and phys_slideconstraint.

◆ KeepUpright()

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

◆ OnRemoveEntity()

void ncPhysicsConstraint::OnRemoveEntity ( void  )
virtual

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

Reimplemented from ncIO.

◆ Restore()

void ncPhysicsConstraint::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 ncEntity.

Reimplemented in phys_convert, phys_hinge, phys_keepupright, and phys_slideconstraint.

◆ Rope()

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

Creates a ballsocket constraint and returns it.

◆ Save()

void ncPhysicsConstraint::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 ncEntity.

Reimplemented in phys_convert, phys_hinge, phys_keepupright, and phys_slideconstraint.

◆ SetConstraintType()

void ncPhysicsConstraint::SetConstraintType ( constraint_t  setValue)

Will override the constraint type this entity represents.

See constraint_t for choices.

◆ SetEntity1()

void ncPhysicsConstraint::SetEntity1 ( entity  targetEnt)

Sets the first entity in the connection.

Needs to be set.

◆ SetEntity2()

void ncPhysicsConstraint::SetEntity2 ( entity  targetEnt)

Sets the second entity in the connection.

Can be world.

◆ SetSliderFriction()

void ncPhysicsConstraint::SetSliderFriction ( float  frictionValue)

Sets the friction of the slider.

◆ SetSliderMaxVelocity()

void ncPhysicsConstraint::SetSliderMaxVelocity ( float  maxVel)

Sets the max velocity on a CONSTRAINT_SLIDER type ncPhysicsConstraint.

◆ SetSliderStop()

void ncPhysicsConstraint::SetSliderStop ( float  stopVal)

Sets the maximum travel distance of the slider.

◆ SetSliderVelocity()

void ncPhysicsConstraint::SetSliderVelocity ( float  slideVel)

Sets the velocity on a CONSTRAINT_SLIDER type ncPhysicsConstraint.

◆ Spawned()

void ncPhysicsConstraint::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 ncEntity.

Reimplemented in phys_convert.

◆ SpawnKey()

void ncPhysicsConstraint::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 ncEntity.

Reimplemented in phys_convert, phys_hinge, phys_keepupright, and phys_slideconstraint.

◆ WakeTargets()

void ncPhysicsConstraint::WakeTargets ( void  )

Awakes the entities this constraint is connected to.

◆ Weld()

ncPhysicsConstraint ncPhysicsConstraint::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: