Main Page | Class Hierarchy | Alphabetical List | Compound List | Compound Members

# IRiPhysicsCommand Struct Reference

Inherits IDispatch.

List of all members.

## Public Member Functions
HRESULT | RegisterObj ([in]BSTR bstrObjName,[in] BSTR bstrEngineName)
HRESULT | UnRegisterObj ([in] BSTR bstrObjName,[in] BSTR bstrEngineName)
HRESULT | StartSimulation ([in] BSTR bstrEngineName)
HRESULT | StopSimulation ([in] BSTR bstrEngineName)
HRESULT | SimpleCollision ([in] BSTR objname1,[in] BSTR objname2,[in] RtBool precision,[out, retval] RtBool *collision)
HRESULT | InitCollision ([in] BSTR SpaceName)
HRESULT | AddPhysAttr ([in] BSTR ObjName)
HRESULT | RemovePhysAttr ([in] BSTR ObjName)
HRESULT | CreateEngine ([in] BSTR bstrSpaceRootName,[out, retval] BSTR *bstrEngineName)
HRESULT | InitEngine ([in] BSTR bstrEngineName,[in] RtFloat totaltime,[in] RtDWORD timestep,[in] RtBool bContinue)
HRESULT | AddEnvAttr ([in] BSTR ObjName)
HRESULT | RemoveEnvAttr ([in] BSTR ObjName)
HRESULT | AddWind ([in] BSTR SpaceName,[in] RtBool local)

## Detailed Description

The IRiPhysicsCommand interface provides basic methods that enable a management of physical simulation in Player. It includes methods for starting and stopping of simulation and also methods for setting of physical parameters to objects in the scene. Using interface's methods, it is not only possible to start or stop simulation in various spaces, but directly to affect a running simulation by additions or removing objects.
Root-level name in the scripting engine's name space: Physics

## Member Function Documentation

HRESULT IRiPhysicsCommand::RegisterObj | ( | [in] BSTR | bstrObjName,
|  | [in] BSTR | bstrEngineName
| ) |

  | Adds object with physical attributes to simulation controllen by physical engine. Both object and engine have to be in the same space. If simulation is runnning, object is immediately included to simulation. Parameters:
  bstrObjName | – full name identification of object
  bstrEngineName | – full name identification of physical engine
Use following syntax if you want to add object to simulation
     Physics.PhysRegisterObj('/Project/Space 3D/Sphere', '/Project/Space 3D/PhysEngine' )

HRESULT IRiPhysicsCommand::UnRegisterObj | ( | [in] BSTR | bstrObjName,
|  | [in] BSTR | bstrEngineName
| ) |

  | Removes object with physical attributes to simulation controllen by physical engine. Both object and engine have to be in the same space. If simulation is runnning, object is immediately excluded from simulation. Parameters:
  bstrObjName | – full name identification of object
  bstrEngineName | – full name identification of physical engine

HRESULT IRiPhysicsCommand::StartSimulation | ( | [in] BSTR | bstrEngineName | ) |

  | Starts simulation controlled by physical engine with name bstrEngineName. Simulation is started in the space in which physical engine is present. Parameters:
  bstrEngineName | – full name identification of physical engine

HRESULT IRiPhysicsCommand::StopSimulation | ( | [in] BSTR | bstrEngineName | ) |

  | Stops simulation controlled by physical engine with name bstrEngineName. Parameters:
  bstrEngineName | – full name identification of physical engine

HRESULT IRiPhysicsCommand::SimpleCollision | ( | [in] BSTR | objname1,
|  | [in] BSTR | objname2,
|  | [in] RtBool | precision,
|  | [out, retval] RtBool * | collision
| ) |

  | Checks collision between two objects with two levels of precision - with object's bounding boxes or object's meshes intersections Parameters:
  objname1 | – full name identification of first object
  objname2 | – full name identification of second object
  precision | – collison precision, if precison is FALSE bounding boxes are used, if is TRUE, full objet's mesh-mesh intersections are checked
  collision | - returns TRUE if collision occured, FALSE if is no collision

HRESULT IRiPhysicsCommand::InitCollision | ( | [in] BSTR | SpaceName | ) |

  | Inits collision detection mechanism for given space. Parameters:
  SpaceName | – full name identification of space

HRESULT IRiPhysicsCommand::AddPhysAttr | ( | [in] BSTR | ObjName | ) |

  | Sets default physical attributes for object Parameters:
  ObjName | – full name identification of object

HRESULT IRiPhysicsCommand::RemovePhysAttr | ( | [in] BSTR | ObjName | ) |

  | Removes physical attributes from object Parameters:
  ObjName | – full name identification of object

HRESULT IRiPhysicsCommand::CreateEngine | ( | [in] BSTR | bstrSpaceRootName,
|  | [out, retval] BSTR * | bstrEngineName
| ) |

  | Creates physical engine node in space Parameters:
  bstrSpaceRootName | – full name identification of space
  bstrEngineName | – returns full name identification of created physical engine node

HRESULT IRiPhysicsCommand::InitEngine | ( | [in] BSTR | bstrEngineName,
|  | [in] RtFloat | totaltime,
|  | [in] RtDWORD | timestep,
|  | [in] RtBool | bContinue
| ) |

  | Inits physical engine node and sets basic simulation parameters Parameters:
  bstrEngineName | – full name identification of physical engine
  totaltime | – time interval in seconds when simulation should run
  timestep | - precision of calculations, higher values calculate simulation more realistics but reduce speed of computation
  bContinue | - if FALSE, objects will return to their initial positions after stop of simulation, if TRUE, objects remain in their final positions after simualation
     Physics.InitEngine('/Project/Space 3D/PhysEngine', 40.0, 2, FALSE )

HRESULT IRiPhysicsCommand::AddEnvAttr | ( | [in] BSTR | ObjName | ) |

  | Sets default local environmental attributes for object Parameters:
  ObjName | – full name identification of object

HRESULT IRiPhysicsCommand::RemoveEnvAttr | ( | [in] BSTR | ObjName | ) |

  | Removes local environmental attributes from object Parameters:
  ObjName | – full name identification of object

HRESULT IRiPhysicsCommand::AddWind | ( | [in] BSTR | SpaceName,
|  | [in] RtBool | local
| ) |

  | Adds wind node to space Parameters:
  SpaceName | – full name identification of space
  local | – if TRUE, wind is local, if FALSE wind is global