# IRnPhysEngine Interface Reference

Inherits IUnknown.

List of all members.

## Public Member Functions
HRESULT | InitPhysEngine (void)
HRESULT | StartSimulation (void)
HRESULT | StopSimulation ([in] RtBool *bContinue)
HRESULT | GetActiveState ([out] RtBool *bActive)
HRESULT | RegisterObj ([in] IRsBaseNode *pNode)
HRESULT | UnRegisterObj ([in] IRsBaseNode *pNode)
HRESULT | PickPhysObj ([in] RtPoint *pScreenPoint,[in] IRsNode *pView,[out] IRsNode **pSelNode)
HRESULT | SetMouseMove ([in] RtPoint *pScreenPoint,[in] IRsNode *pView,[in] RtShort *flags)
HRESULT | FreePickedObj (void)
HRESULT | AddImpulse ([in] IRsNode *pNode,[in] RtPoint force,[in] RtPoint torque)
HRESULT | EnumObjects ([in] RtFloat *box,[in] RtBool bSubObj,[out] IRsList **ppList)
HRESULT | BlockNetworkSync ([in] RtBool bBlock)
HRESULT | ActivateObj ([in] IRsBaseNode *pNode,[in] RtBool bActivate)
HRESULT | NetworkStatus ([out] RtUshort *uStatus)

## Detailed Description

The IRnPhysEngine interface provides methods for work with PhysEngine object.

## Member Function Documentation

HRESULT IRnPhysEngine::InitPhysEngine | ( | void |  | ) |

Initialize phys engine object and all objects included in simulation.

Returns:
  standard HRESULT processing can be applied to returned value.

HRESULT IRnPhysEngine::StartSimulation | ( | void |  | ) |

Start simulation managed by internal timer, there is no need to call InitPhysEngine method if engine is started using this method.

Returns:
  standard HRESULT processing can be applied to returned value.

HRESULT IRnPhysEngine::StopSimulation | ( | [in] RtBool * | bContinue | ) |

StopSimulation - stops simulation managed by internal timer. All internal data structure is freed.

Parameters:

  | bContinue | [in] If FALSE, objects are returned back to their original positions, if TRUE objects remain in their last position.

Returns:
  standard HRESULT processing can be applied to returned value.

HRESULT IRnPhysEngine::GetActiveState | ( | [out] RtBool * | bActive | ) |

Return the status of engine object.

Parameters:

  | bActive | [out] If TRUE engine is running, if FALSE engine is inactive.

Returns:
  standard HRESULT processing can be applied to returned value.

HRESULT IRnPhysEngine::RegisterObj | ( | [in] IRsBaseNode * | pNode | ) |

RegisterObj - adds object to running simulation, if object is animated, animation is switched to simulation for that object.

Parameters:

  | pNode | [in] Object to add.

Returns:
  standard HRESULT processing can be applied to returned value.

HRESULT IRnPhysEngine::UnRegisterObj | ( | [in] IRsBaseNode * | pNode | ) |

Remove object to running simulation, if object is animated, simulation is switched to animation for that object.

Parameters:

  | pNode | [in] Object to remove.

Returns:
  standard HRESULT processing can be applied to returned value.

HRESULT IRnPhysEngine::PickPhysObj | ( | [in] RtPoint * | pScreenPoint,
|  | [in] IRsNode * | pView,
|  | [out] IRsNode ** | pSelNode |
| ) |  |  |

Pick and select object in running simulation for next manipulation with mouse.

Parameters:

  | pScreenPoint | [in] Screen point.
  | pView | View node.
  | pSelNode | - v Picked object, if NULL no object is picked.

Returns:
  standard HRESULT processing can be applied to returned value.

HRESULT IRnPhysEngine::SetMouseMove | ( | [in] RtPoint * | pScreenPoint,
|  | [in] IRsNode * | pView,
|  | [in] RtShort * | flags |
| ) |  |  |

Set mouse movement to object in running simulation according mouse movement.

Parameters:

  | pScreenPoint | [in] Screen point.
  | pView | [in] View node.
  | flags | [in] Parameters of translation process.

Returns:
  standard HRESULT processing can be applied to returned value.

HRESULT IRnPhysEngine::FreePickedObj | ( | void |  | ) |

Free picked object (returned from previous call to PickPhysObj method).

Returns:
  standard HRESULT processing can be applied to returned value.

HRESULT IRnPhysEngine::AddImpulse | ( | [in] IRsNode * | pNode,
|  | [in] RtPoint | force,
|  | [in] RtPoint | torque |
| ) |  |  |

Add impulse to object in running simulation.

Parameters:

  | pNode | [in] Pointer to object.
  | force | [in] Impulse force (acceleration).
  | torque | [in] Torque force (angular acceleration).

HRESULT IRnPhysEngine::EnumObjects | ( | [in] RtFloat * | box,
|  | [in] RtBool | bSubObj,
|  | [out] IRsList ** | ppList |
| ) |  |  |

Enumerate all objects in given box.

Parameters:

  | box | [in] Float array of box {xmin, xmax, ymin, ymax, zmin, zmax}.
  | bSubObj | [in] If TRUE all objects and their sub objects are included, if FALSE only phys objects are listed.
  | ppList | [in] List of objects.

HRESULT IRnPhysEngine::BlockNetworkSync | ( | [in] RtBool | bBlock | ) |

Block all network communication.

Parameters:

  | bBlock | [in] If TRUE network communication is blocked, if FALSE is unblocked.

HRESULT IRnPhysEngine::ActivateObj | ( | [in] IRsBaseNode * | pNode,
|  | [in] RtBool | bActivate |
| ) |  |  |

Activate/Deactivate physics for object in running simulation, if object is deactivated, simulation is switched to animation for that object.

Parameters:

  | pNode | [in] Object to activate/deactivate.
  | bActivate | [in] If TRUE object is activate, if FALSE object is deactivated.

Returns:
  standard HRESULT processing can be applied to returned value.

HRESULT IRnPhysEngine::NetworkStatus | ( | [out] RtUshort * | uStatus | ) |

Get engine's network status.

Parameters:

  | uStatus | [out] Engine's network status: 0 - local mode, 1 - server master, 2 - server slave