Nuclide
Software Development Kit for id Technology (BETA)
Loading...
Searching...
No Matches
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.
 
virtual void Save (float)
 Handles saving a copy of this entity to a given filehandle.
 
virtual void Restore (string, string)
 Similar to ncIO::SpawnKey() but for save-game fields.
 
virtual void Input (entity, string, string)
 Called when we are being prompted by another object/function with an input message.
 
virtual void Spawned (void)
 Called when the entity is fulled initialized.
 
virtual void OnRemoveEntity (void)
 Handles what happens before the entity gets removed from the client game.
 
nonvirtual void WakeTargets (void)
 Awakes the entities this constraint is connected to.
 
nonvirtual void Break (entity)
 Breaks the constraint.
 
nonvirtual constraint_t GetConstraintType (void)
 Returns the type of this constraint entity.
 
nonvirtual entity GetEntity1 (void)
 Returns the first entity connection.
 
nonvirtual entity GetEntity2 (void)
 Returns the second entity connection.
 
nonvirtual void SetConstraintType (constraint_t)
 Will override the constraint type this entity represents.
 
nonvirtual void SetEntity1 (entity)
 Sets the first entity in the connection.
 
nonvirtual void SetEntity2 (entity)
 Sets the second entity in the connection.
 
nonvirtual void SetSliderVelocity (float)
 Sets the velocity on a CONSTRAINT_SLIDER type ncPhysicsConstraint.
 
nonvirtual void SetSliderMaxVelocity (float)
 Sets the max velocity on a CONSTRAINT_SLIDER type ncPhysicsConstraint.
 
nonvirtual void SetSliderStop (float)
 Sets the maximum travel distance of the slider.
 
nonvirtual void SetSliderFriction (float)
 Sets the friction of the slider.
 
nonvirtual float GetSliderVelocity (void)
 Returns the velocity of a CONSTRAINT_SLIDER type ncPhysicsConstraint.
 
nonvirtual float GetSliderMaxVelocity (void)
 Returns the max velocity of a CONSTRAINT_SLIDER type ncPhysicsConstraint.
 
nonvirtual float GetSliderStop (void)
 Returns the maximum travel distance of the slider.
 
nonvirtual float GetSliderFriction (void)
 Returns the friction of the slider.
 
nonvirtual float GetConstraintSystemID (void)
 Returns the unique joint group ID associated with a phys_constraintsystem.
 
nonvirtual ncPhysicsConstraint Ballsocket (entity, entity, vector, vector, float, bool)
 Creates a ballsocket constraint and returns it.
 
nonvirtual ncPhysicsConstraint Weld (entity, entity, float, float, float, bool, bool)
 Creates a ballsocket constraint and returns it.
 
nonvirtual ncPhysicsConstraint Rope (entity, entity, vector, vector)
 Creates a ballsocket constraint and returns it.
 
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 ncTrigger.

◆ Restore()

void ncPhysicsConstraint::Restore ( string keyName,
string setValue )
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 keyName,
string setValue )
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: