| ## Public API Reference

- Main Page
- Classes
- Files

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

# iPcMechanicsObject Struct Reference

A dynamic body. More...

`#include <propclass/mechsys.h>`

List of all members.

## Public Member Functions
virtual void | AddForceDuration (const csVector3 &force, bool relative, const csVector3 &position, float seconds)=0
| During the specified time (in seconds) add the force every step.
virtual void | AddForceFrame (const csVector3 &force, bool relative, const csVector3 &position)=0
| During the next frame add the force every step.
virtual void | AddForceOnce (const csVector3 &force, bool relative, const csVector3 &position)=0
| Add a force once to the given object.
virtual uint32 | AddForceTagged (const csVector3 &force, bool relative, const csVector3 &position)=0
| Add a force with the given tag, to be manually removed later.
virtual void | AddToGroup (const char *group)=0
| Add this body to the specified group.
virtual void | AttachColliderBox (const csVector3 &size, const csOrthoTransform &trans)=0
| Create a box collider for this object.
virtual void | AttachColliderCylinder (float length, float radius, const csOrthoTransform &trans)=0
| Create a cylinder collider for this object.
virtual void | AttachColliderMesh ()=0
| Create a mesh collider for this object from the attached iPcMesh.
virtual void | AttachColliderPlane (const csPlane3 &plane)=0
| Create a plane collider for this object.
virtual void | AttachColliderSphere (float radius, const csVector3 &offset)=0
| Create a sphere collider for this object.
virtual void | ClearForces ()=0
| Clear the permanent forces on this body.
virtual iJoint * | CreateJoint (iPcMechanicsObject *other)=0
| Create a joint between this object and another.
virtual const csVector3 | GetAngularVelocity ()=0
| Get the current angular velocity (rotation) of the object.
virtual iRigidBody * | GetBody ()=0
| Get the associated rigid body.
virtual iPcCamera * | GetCamera ()=0
| Get the associated camera property class.
virtual float | GetDensity ()=0
| Get the object's density.
virtual float | GetDrag ()=0
| Get the object's drag.
virtual float | GetElasticity ()=0
| Get the object's elasticity.
virtual float | GetFriction ()=0
| Get the object's friction.
virtual const csVector3 & | GetLift ()=0
| Get the object's lift.
virtual iPcLight * | GetLight ()=0
| Get the associated light property class.
virtual const csVector3 | GetLinearVelocity ()=0
| Get the current linear velocity (movement) of the object.
virtual float | GetMass ()=0
| Get the object's mass.
virtual iPcMechanicsSystem * | GetMechanicsSystem ()=0
| Get the associated mechanics system.
virtual iPcMesh * | GetMesh ()=0
| Get the associated mesh property class.
virtual float | GetSoftness ()=0
| Get the object's softness.
virtual bool | IsStatic () const =0
| Return true if static.
virtual csVector3 | LocalToWorld (csVector3 local)=0
| Convert a vector from this objects local system to world coord system.
virtual void | MakeStatic (bool stat)=0
| Make static.
virtual void | RemoveForceTagged (uint32 forceid)=0
| Remove the force with the given tag.
virtual void | RemoveFromGroup (const char *group)=0
| Remove this body from the specified group.
virtual void | SetAngularVelocity (const csVector3 &vel)=0
| Set the initial angular velocity (rotation) of the object.
virtual void | SetCamera (iPcCamera *camera)=0
| Set the camera which this body will control.
virtual void | SetDensity (float density)=0
| Set the object's density.
virtual void | SetDrag (float drag)=0
| Set the object's drag.
virtual void | SetElasticity (float elasticity)=0
| Set the object's elasticity.
virtual void | SetFriction (float friction)=0
| Set the object's friction.
virtual void | SetLift (const csVector3 &lift)=0
| Set the object's lift.
virtual void | SetLight (iPcLight *light)=0
| Set the light which this body will control.
virtual void | SetLinearVelocity (const csVector3 &vel)=0
| Set the initial linear velocity (movement) of the object.
virtual void | SetMass (float mass)=0
| Set the object's mass.
virtual void | SetMechanicsSystem (iPcMechanicsSystem *mechsys)=0
| Set the mechanics system to use.
virtual void | SetMesh (iPcMesh *mesh)=0
| Set the mesh which this body will control.
virtual void | SetSoftness (float softness)=0
| Set the object's softness.
virtual csVector3 | WorldToLocal (csVector3 world)=0
| Convert a vector from world coord system to this objects local system.

## Detailed Description

A dynamic body.

This property class can send out the following messages to the behaviour (add prefix 'cel.parameter.' to get the ID for parameters):

- pcdynamicbody_collision: an entity has collided with this entity.

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

- InitPhys: parameters 'friction' (float), 'elasticity' (float), 'density' (float), 'softness' (float), 'lift' (vector3), and 'drag' (float).
- MakeStatic: parameters 'static' (bool).
- SetSystem: parameters 'syspcent' (string) and 'syspctag' (string).
- SetMesh: parameters 'mechpctag' (string).
- SetColliderSphere: parameters 'radius' (float) and 'offset' (vector3).
- SetColliderCylinder: parameters 'length' (float), 'radius' (float) 'axis' (vector3), 'offset' (vector3), and 'angle' (float).
- SetColliderBox: parameters 'size' (vector3), 'axis' (vector3), 'angle' (float), and 'offset' (vector3).
- SetColliderPlane: parameters 'normal' (vector3) and 'offset' (float).
- SetColliderMesh: no parameters.
- SetLinearVelocity: parameters 'velocity' (vector3).
- SetAngularVelocity: parameters 'velocity' (vector3).
- AddForceOnce: parameters 'force' (vector3), 'relative' (bool), and 'position' (vector3).
- AddForceDuration: parameters 'force' (vector3), 'relative' (bool), 'position' (vector3), and 'seconds' (float).
- AddForceFrame: parameters 'force' (vector3), 'relative' (bool), and 'position' (vector3).
- AddForceTagged: parameters 'force' (vector3), 'relative' (bool), and 'position' (vector3). The tag will be set in the property 'cel.property.lasttag'.
- RemoveForceTagged: parameters 'tag' (long).
- ClearForces: no parameters.
- SetPosition: parameters 'position' (vector3).
- ClearRotation: no parameters.
- LookAt: parameters 'forward' (vector3) and 'up' (vector3).

This property class supports the following properties (add prefix 'cel.property.' to get the ID of the property:

- lasttag (long, read): last tag returned by AddForceTagged action.

Definition at line 272 of file mechsys.h.

## Member Function Documentation

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

  | During the specified time (in seconds) add the force every step. Parameters:
  | 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 iPcMechanicsObject::AddForceFrame | ( | const csVector3 & | force,
|  | bool | relative,
|  | const csVector3 & | position
| ) | `[pure virtual]`

  | During the next frame add the force every step. Parameters:
  | 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 iPcMechanicsObject::AddForceOnce | ( | const csVector3 & | force,
|  | bool | relative,
|  | const csVector3 & | position
| ) | `[pure virtual]`

  | Add a force once to the given object. Parameters:
  | 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 uint32 iPcMechanicsObject::AddForceTagged | ( | const csVector3 & | force,
|  | bool | relative,
|  | const csVector3 & | position
| ) | `[pure virtual]`

  | Add a force with the given tag, to be manually removed later. Parameters:
  | 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. return value is the force id tag (use it to remove the force later).

virtual void iPcMechanicsObject::AddToGroup | ( | const char * | group | ) | `[pure virtual]`

  | Add this body to the specified group. Parameters:
  | group | the name of the group to add the body to. Creates the group if it does not exist.

virtual void iPcMechanicsObject::AttachColliderBox | ( | const csVector3 & | size,
|  | const csOrthoTransform & | trans
| ) | `[pure virtual]`

  | Create a box collider for this object. Parameters:
  | size | the size of the box in each direction.
  | trans | the transformation to apply to the box.

virtual void iPcMechanicsObject::AttachColliderCylinder | ( | float | length,
|  | float | radius,
|  | const csOrthoTransform & | trans
| ) | `[pure virtual]`

  | Create a cylinder collider for this object. Parameters:
  | length | the length of the cylinder.
  | radius | the radius of the cylinder.
  | trans | the transformation to apply to the cylinder.

virtual void iPcMechanicsObject::AttachColliderMesh | ( |  | ) | `[pure virtual]`

| Create a mesh collider for this object from the attached iPcMesh.

virtual void iPcMechanicsObject::AttachColliderPlane | ( | const csPlane3 & | plane | ) | `[pure virtual]`

  | Create a plane collider for this object. Parameters:
  | plane | the definition of the plane to use.

virtual void iPcMechanicsObject::AttachColliderSphere | ( | float | radius,
|  | const csVector3 & | offset
| ) | `[pure virtual]`

  | Create a sphere collider for this object. Parameters:
  | radius | the radius of the sphere.
  | offset | the offset from the center of the object to the center of the sphere.

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

| Clear the permanent forces on this body.

virtual iJoint* iPcMechanicsObject::CreateJoint | ( | iPcMechanicsObject * | other | ) | `[pure virtual]`

| Create a joint between this object and another.

virtual const csVector3 iPcMechanicsObject::GetAngularVelocity | ( |  | ) | `[pure virtual]`

| Get the current angular velocity (rotation) of the object.

virtual iRigidBody* iPcMechanicsObject::GetBody | ( |  | ) | `[pure virtual]`

| Get the associated rigid body.

virtual iPcCamera* iPcMechanicsObject::GetCamera | ( |  | ) | `[pure virtual]`

| Get the associated camera property class.

virtual float iPcMechanicsObject::GetDensity | ( |  | ) | `[pure virtual]`

| Get the object's density. Must be called before Attach..., otherwise defaults to 1.

virtual float iPcMechanicsObject::GetDrag | ( |  | ) | `[pure virtual]`

| Get the object's drag. Must be called before Attach..., otherwise defaults to 0.

virtual float iPcMechanicsObject::GetElasticity | ( |  | ) | `[pure virtual]`

| Get the object's elasticity. Must be called before Attach..., otherwise defaults to 0.

virtual float iPcMechanicsObject::GetFriction | ( |  | ) | `[pure virtual]`

| Get the object's friction. Must be called before Attach..., otherwise defaults to 1.

virtual const csVector3& iPcMechanicsObject::GetLift | ( |  | ) | `[pure virtual]`

| Get the object's lift. Must be called before Attach..., otherwise defaults to 0.

virtual iPcLight* iPcMechanicsObject::GetLight | ( |  | ) | `[pure virtual]`

| Get the associated light property class.

virtual const csVector3 iPcMechanicsObject::GetLinearVelocity | ( |  | ) | `[pure virtual]`

| Get the current linear velocity (movement) of the object.

virtual float iPcMechanicsObject::GetMass | ( |  | ) | `[pure virtual]`

| Get the object's mass. Must be called before Attach..., otherwise defaults to 1.

virtual iPcMechanicsSystem* iPcMechanicsObject::GetMechanicsSystem | ( |  | ) | `[pure virtual]`

| Get the associated mechanics system.

virtual iPcMesh* iPcMechanicsObject::GetMesh | ( |  | ) | `[pure virtual]`

| Get the associated mesh property class.

virtual float iPcMechanicsObject::GetSoftness | ( |  | ) | `[pure virtual]`

| Get the object's softness. Must be called before Attach..., otherwise defaults to 0.

virtual bool iPcMechanicsObject::IsStatic | ( |  | ) | const`[pure virtual]`

| Return true if static.

virtual csVector3 iPcMechanicsObject::LocalToWorld | ( | csVector3 | local | ) | `[pure virtual]`

| Convert a vector from this objects local system to world coord system.

virtual void iPcMechanicsObject::MakeStatic | ( | bool | stat | ) | `[pure virtual]`

  | Make static. Parameters:
  | stat | if true, the object is static; otherwise it is affected by forces.

virtual void iPcMechanicsObject::RemoveForceTagged | ( | uint32 | forceid | ) | `[pure virtual]`

  | Remove the force with the given tag. Parameters:
  | forceid | the tag of the desired force.

virtual void iPcMechanicsObject::RemoveFromGroup | ( | const char * | group | ) | `[pure virtual]`

  | Remove this body from the specified group. Parameters:
  | group | the name of the group to remove the body from.

virtual void iPcMechanicsObject::SetAngularVelocity | ( | const csVector3 & | vel | ) | `[pure virtual]`

  | Set the initial angular velocity (rotation) of the object. Parameters:
  | vel | the angular velocity to apply to the object

virtual void iPcMechanicsObject::SetCamera | ( | iPcCamera * | camera | ) | `[pure virtual]`

  | Set the camera which this body will control. If this is used then this overrides the default behaviour of trying to find 'pcmesh', 'pclight', and 'pccamera' in that order. Parameters:
  | camera | a pointer to the iPcCamera to control.

virtual void iPcMechanicsObject::SetDensity | ( | float | density | ) | `[pure virtual]`

  | Set the object's density. Must be called before Attach..., otherwise defaults to 1. Parameters:
  | density | the density of this object.

virtual void iPcMechanicsObject::SetDrag | ( | float | drag | ) | `[pure virtual]`

  | Set the object's drag. Must be called before Attach..., otherwise defaults to 0. Parameters:
  | drag | the drag generated by this object in a fluid.

virtual void iPcMechanicsObject::SetElasticity | ( | float | elasticity | ) | `[pure virtual]`

  | Set the object's elasticity. Must be called before Attach..., otherwise defaults to 0. Parameters:
  | elasticity | the elasticity of this object.

virtual void iPcMechanicsObject::SetFriction | ( | float | friction | ) | `[pure virtual]`

  | Set the object's friction. Must be called before Attach..., otherwise defaults to 1. Parameters:
  | friction | the friction coefficient for this object.

virtual void iPcMechanicsObject::SetLift | ( | const csVector3 & | lift | ) | `[pure virtual]`

  | Set the object's lift. Must be called before Attach..., otherwise defaults to 0. Parameters:
  | lift | the lift generated by this object in a fluid.

virtual void iPcMechanicsObject::SetLight | ( | iPcLight * | light | ) | `[pure virtual]`

  | Set the light which this body will control. If this is used then this overrides the default behaviour of trying to find 'pcmesh', 'pclight', and 'pccamera' in that order. Parameters:
  | light | a pointer to the iPcLight to control.

virtual void iPcMechanicsObject::SetLinearVelocity | ( | const csVector3 & | vel | ) | `[pure virtual]`

  | Set the initial linear velocity (movement) of the object. Parameters:
  | vel | the linear velocity to apply to the object.

virtual void iPcMechanicsObject::SetMass | ( | float | mass | ) | `[pure virtual]`

  | Set the object's mass. Must be called before Attach..., otherwise defaults to 1. Parameters:
  | mass | the mass of this object.

virtual void iPcMechanicsObject::SetMechanicsSystem | ( | iPcMechanicsSystem * | mechsys | ) | `[pure virtual]`

  | Set the mechanics system to use. If you don't do this then the object will look in the object registry for a suitable mechanics system. Parameters:
  | mechsys | a pointer to the iPcMechanicsSystem to use.

virtual void iPcMechanicsObject::SetMesh | ( | iPcMesh * | mesh | ) | `[pure virtual]`

  | Set the mesh which this body will control. If this is used then this overrides the default behaviour of trying to find 'pcmesh', 'pclight', and 'pccamera' in that order. Parameters:
  | mesh | a pointer to the iPcMesh to control.

virtual void iPcMechanicsObject::SetSoftness | ( | float | softness | ) | `[pure virtual]`

  | Set the object's softness. Must be called before Attach..., otherwise defaults to 0. Parameters:
  | softness | the softness of this object.

virtual csVector3 iPcMechanicsObject::WorldToLocal | ( | csVector3 | world | ) | `[pure virtual]`

| Convert a vector from world coord system to this objects local system.

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

- propclass/mechsys.h