## Public API Reference

- Main Page
- Classes
- Files

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# iPcMechanicsSystem Struct Reference

Property class representing a dynamic system. More...

`#include <propclass/mechsys.h>`

List of all members.

## Public Member Functions

virtual void | AddBodyToGroup (iRigidBody *body, const char *group)=0
| Add a body to the specified group.
virtual void | AddForceDuration (iPcMechanicsObject *pcobject, const csVector3 &force, bool relative, const csVector3 &position, float seconds)=0
| During the specified time (in milliseconds) add the force every step to the given body.
virtual void | AddForceFrame (iPcMechanicsObject *pcobject, const csVector3 &force, bool relative, const csVector3 &position)=0
| During the next frame add the force every step.
virtual void | AddForceTagged (iPcMechanicsObject *pcobject, const csVector3 &force, bool relative, const csVector3 &position, uint32 forceid)=0
| Add a force with the given tag, to be manually removed later.
virtual void | ClearAllForces ()=0
| Clear all forces.
virtual void | ClearForces (iPcMechanicsObject *pcobject)=0
| Remove the given body from the force queues (filled with AddForceFrame() and AddForceDuration()).
virtual csPtr< iRigidBody > | CreateBody ()=0
| Create an iRigidBody and add it to the system.
virtual iJoint * | CreateJoint (iRigidBody *body1, iRigidBody *body2)=0
| Create a joint between the two given bodies.
virtual void | DisableStepFast ()=0
| Disable fast stepping.
virtual void | EnableQuickStep ()=0
| Very fast but not accurate.
virtual void | EnableStepFast ()=0
| Enable fast stepping.
virtual iDynamicSystem * | GetDynamicSystem ()=0
| Get the dynamic system.
virtual const csVector3 | GetGravity ()=0
| Get the current gravity.
virtual float | GetSimulationSpeed ()=0
| Get the current simulation speed.
virtual float | GetStepTime () const =0
| Get the current step time.
virtual void | RemoveBody (iRigidBody *body)=0
| Remove a given iRigidBody from the system.
virtual void | RemoveBodyFromGroup (iRigidBody *body, const char *group)=0
| Remove a body from the specified group.
virtual void | RemoveForceTagged (iPcMechanicsObject *pcobject, uint32 forceid)=0
| Remove the force with the given tag.
virtual void | RemoveJoint (iJoint *joint)=0
| Remove a given joint from the system.
virtual void | SetDynamicSystem (const char *dynsysname)=0
| Set the dynamic system.
virtual void | SetDynamicSystem (iDynamicSystem *dynsys)=0
| Set the dynamic system.
virtual void | SetGravity (const csVector3 &grav)=0
| Define the gravity for the system.
virtual void | SetSimulationSpeed (float simulationspeed)=0
| Define the how fast we want the simulation to go.
virtual void | SetStepTime (float delta)=0
| Define the time we want for one step.

## Detailed Description

Property class representing a dynamic system.

This property class supports the following actions (add prefix 'cel.action.' to get the ID of the action and add prefix 'cel.parameter.' to get the ID of the parameter):

- SetSystem: parameters 'dynsys' (string).
- SetGravity: parameters 'gravity' (float).
- SetStepTime: parameters 'time' (float).
- QuickStep: no parameters.
- EnableStepFast: no parameters.
- DisableStepFast: no parameters.

Definition at line 56 of file mechsys.h.

## Member Function Documentation

virtual void iPcMechanicsSystem::AddBodyToGroup | ( | iRigidBody * | body,
|  | const char * | group |
| ) |  |  | `[pure virtual]`

Add a body to the specified group.

Parameters:

  | body | the body to add to the group.
  | group | the name of the group to add the body to. Creates the group if it does not exist.

virtual void iPcMechanicsSystem::AddForceDuration | ( | iPcMechanicsObject * | pcobject,
|  | const csVector3 & | force,
|  | bool | relative,
|  | const csVector3 & | position,
|  | float | seconds |
| ) |  |  | `[pure virtual]`

During the specified time (in milliseconds) add the force every step to the given body.

This function is called by iPcMechanicsObject::AddForceDuration().

Parameters:

  | pcobject | a pointer to the object that will receive this force every step until the end of the given time.
  | force | a vector representing the force to add to this object.
  | relative | if set to true, the given force and position are both in object space; otherwise they are in world space.
  | position | the position of the force.
  | seconds | the number of seconds that this force should last.

virtual void iPcMechanicsSystem::AddForceFrame | ( | iPcMechanicsObject * | pcobject,
|  | const csVector3 & | force,
|  | bool | relative,
|  | const csVector3 & | position |
| ) |  |  | `[pure virtual]`

During the next frame add the force every step.

This function is called by iPcMechanicsObject::AddForceFrame().

Parameters:

  | pcobject | a pointer to the object that will receive this force every step until the end of the frame.
  | force | a vector representing the force to add to this object.
  | relative | if set to true, the given force and position are both in object space; otherwise they are in world space.
  | position | the position of the force.

virtual void iPcMechanicsSystem::AddForceTagged | ( | iPcMechanicsObject * | pcobject,
|  | const csVector3 & | force,
|  | bool | relative,
|  | const csVector3 & | position,
|  | uint32 | forceid |
| ) |  |  | `[pure virtual]`

Add a force with the given tag, to be manually removed later.

This function is called by iPcMechanicsObject::AddForceTagged().

Parameters:

  | pcobject | a pointer to the object that will receive this force every step until it is removed.
  | force | a vector representing the force to add to this object.
  | relative | if set to true, the given force and position are both in object space; otherwise they are in world space.
  | position | the position of the force.
  | forceid | the tag for this force. (use iCelPlLayer::FetchStringID() to get this.)

virtual void iPcMechanicsSystem::ClearAllForces | ( |  | ) | `[pure virtual]`

Clear all forces.

virtual void iPcMechanicsSystem::ClearForces | ( | iPcMechanicsObject * | pcobject | ) | `[pure virtual]`

Remove the given body from the force queues (filled with AddForceFrame() and AddForceDuration()).

Parameters:

  | pcobject | a pointer to the iPcMechanicsObject to remove all forces from.

virtual csPtr<iRigidBody> iPcMechanicsSystem::CreateBody | ( |  | ) | `[pure virtual]`

Create an iRigidBody and add it to the system.

virtual iJoint* iPcMechanicsSystem::CreateJoint | ( | iRigidBody * | body1,
|  | iRigidBody * | body2 |
| ) |  |  | `[pure virtual]`

Create a joint between the two given bodies.

virtual void iPcMechanicsSystem::DisableStepFast | ( |  | ) | `[pure virtual]`

Disable fast stepping.

This is very accurate but can quickly break with lots of objects.

virtual void iPcMechanicsSystem::EnableQuickStep | ( |  | ) | `[pure virtual]`

Very fast but not accurate.

virtual void iPcMechanicsSystem::EnableStepFast | ( |  | ) | `[pure virtual]`

Enable fast stepping.

This is a lot faster then DisableStepFast(). Default.

virtual iDynamicSystem* iPcMechanicsSystem::GetDynamicSystem | ( |  | ) | `[pure virtual]`

Get the dynamic system.

virtual const csVector3 iPcMechanicsSystem::GetGravity | ( |  | ) | `[pure virtual]`

Get the current gravity.

virtual float iPcMechanicsSystem::GetSimulationSpeed | ( |  | ) | `[pure virtual]`

Get the current simulation speed.

virtual float iPcMechanicsSystem::GetStepTime | ( |  | ) | const`[pure virtual]`

Get the current step time.

virtual void iPcMechanicsSystem::RemoveBody | ( | iRigidBody * | body | ) | `[pure virtual]`

Remove a given iRigidBody from the system.

Parameters:

  | body | the body to remove from the system.

virtual void iPcMechanicsSystem::RemoveBodyFromGroup | ( | iRigidBody * | body,
|  | const char * | group |
| ) |  |  | `[pure virtual]`

Remove a body from the specified group.

Parameters:

  | body | the body to remove from the group.
  | group | the name of the group to remove the body from.

virtual void iPcMechanicsSystem::RemoveForceTagged | ( | iPcMechanicsObject * | pcobject,
|  | uint32 | forceid |
| ) |  |  | `[pure virtual]`

Remove the force with the given tag.

This function is called by iPcMechanicsObject::RemoveForceTagged().

Parameters:

  | pcobject | a pointer to the object that is currently being affected by the given force.
  | forceid | the tag of the desired force.

virtual void iPcMechanicsSystem::RemoveJoint | ( | iJoint * | joint | ) | `[pure virtual]`

Remove a given joint from the system.

virtual void iPcMechanicsSystem::SetDynamicSystem | ( | const char * | dynsysname | ) | `[pure virtual]`

Set the dynamic system.

Parameters:

  | dynsysname | the name of the iDynamicSystem that this iPcMechanicsSystem represents.

virtual void iPcMechanicsSystem::SetDynamicSystem | ( | iDynamicSystem * | dynsys | ) | `[pure virtual]`

Set the dynamic system.

Parameters:

  | dynsys | a pointer to the iDynamicSystem that this iPcMechanicsSystem represents.

virtual void iPcMechanicsSystem::SetGravity | ( | const csVector3 & | grav | ) | `[pure virtual]`

Define the gravity for the system.

By default this is (0,-9.8,0).

Parameters:

  | grav | a vector representing the force of gravity for this system.

virtual void iPcMechanicsSystem::SetSimulationSpeed | ( | float | simulationspeed | ) | `[pure virtual]`

Define the how fast we want the simulation to go.

Default is 1.0. Less is slower, more is faster

Parameters:

  | dsimulationspeed | factor of speed.

virtual void iPcMechanicsSystem::SetStepTime | ( | float | delta | ) | `[pure virtual]`

Define the time we want for one step.

By default this is 0.01 milliseconds.

Parameters:

  | delta | the time (in milliseconds) that one step represents.

The documentation for this struct was generated from the following file:

- propclass/mechsys.h