# IRfPhysHelper Interface Reference

Inherits IUnknown.

List of all members.

## Public Member Functions
HRESULT | CreatePhysEngine ([in] IRnEncapsulator *pRoot,[out, retval] IRsNode **ppEngine)
HRESULT | GetPhysEngine ([in] IRnEncapsulator *pRoot,[out, retval] IRsNode **ppEngine)
HRESULT | GetOctreeObj ([in] IRsNode *pSpace,[out, retval] IRsNode **ppTree)
HRESULT | GetPhysObj ([in] IRsNode *pNode,[out, retval] IRsNode **ppPhysObj)
HRESULT | GetPhysEnvObj ([in] IRsNode *pNode,[out, retval] IRsNode **ppEnvObj)
HRESULT | DisableInSceneOctree ([in] IRsNode *pNode,[in] RtBool bDisable)
HRESULT | GetObjectVolume ([in] IRsNode *pNode,[out, retval] RtFloat *volume)
HRESULT | GetObjectInvariant ([in] IRsNode *pNode,[in] int bLocal,[out] IRdMatrixf **ppInertia,[out] float *pVolume,[out] RtPoint *pCog)
HRESULT | GetBBox ([in] IRsNode *pNode,[out] RtFloat *box)
HRESULT | GetCollisionResponse ([in] IRsNode *pNode,[in] IRdCollInfo *pColl,[out] RtPoint *pSpeed,[out] RtPoint *pRotation)
HRESULT | UpdateObjPosition ([in] IRsNode *pNode,[in] RtPoint *pSpeed,[in] RtPoint *pRotation, RtFloat time)
HRESULT | MovePhysObject ([in]IRsNode *pNode,[in] float deltatime)
HRESULT | SetFixPoint ([in] IRsNode *pNode,[in] RtPoint p)
HRESULT | SetFixPoints ([in] IRsNode *pNode,[in] RtPoint p1,[in] RtPoint p2)
HRESULT | RemoveFixation ([in] IRsNode *pNode)
HRESULT | GetFixPoints ([in]IRsNode *pNode,[out] RtUlong *pNumfix,[out] RtPoint *pP1,[out] RtPoint *pP2)

## Detailed Description

Interface defines helper functions for various operations in physics.

## Member Function Documentation

HRESULT IRfPhysHelper::CreatePhysEngine | ( | [in] IRnEncapsulator * | pRoot,
|  | [out, retval] IRsNode ** | ppEngine |
| ) |  |  |

Creates phys engine object for given space.

Parameters:

  | pRoot | [in] Pointer to space object that is inspected for presence of engine object: If pRoot is NULL, the main space is taken into account.

Returns:
  ppEngine [out, retval] Pointer to engine object:
  - NULL if no engine object is in space.

  standard HRESULT processing can be applied to returned value

HRESULT IRfPhysHelper::GetPhysEngine | ( | [in] IRnEncapsulator * | pRoot,
|  | [out, retval] IRsNode ** | ppEngine |
| ) |  |  |

Returns phys engine object for given space.

Parameters:

  | pRoot | [in] Pointer to space object that is inspected for presence of engine object: If pRoot is NULL, the main space is taken into account.

Returns:
  ppEngine [out, retval] Pointer to engine object:
  - NULL if no engine object is in space.

  standard HRESULT processing can be applied to returned value.

HRESULT IRfPhysHelper::GetOctreeObj | ( | [in] IRsNode * | pSpace,
|  | [out, retval] IRsNode ** | ppTree |
| ) |  |  |

Returns octree object (IRnVolumeTree) for given space:

- Octree object can be used for an access to octree data for space.
- If there is no octree node for space object, method will create and initialize it.

Parameters:

  | pSpace | [in] Pointer to space object that is inspected for presence of octree.

Returns:
  ppTree [out, retval] Pointer to octree object:
  - NULL if no engine object is in space.

  standard HRESULT processing can be applied to returned value

HRESULT IRfPhysHelper::GetPhysObj | ( | [in] IRsNode * | pNode,
|  | [out, retval] IRsNode ** | ppPhysObj |
| ) |  |  |

Returns phys object (IRnPhysActiveObj) for given object:

- phys object represents the phys properties for object.

Parameters:

  | pNode | [in] Pointer to object that is inspected for presence of phys object.

Returns:
  ppPhysObj [out, retval] Pointer to phys object:
  - NULL if no phys object is found.

  standard HRESULT processing can be applied to returned value.

HRESULT IRfPhysHelper::GetPhysEnvObj | ( | [in] IRsNode * | pNode,
|  | [out, retval] IRsNode ** | ppEnvObj |
| ) |  |  |

Returns phys environment object (IRnLocalEnv) for given object:

- phys environment object represents the local environment properties for given object.

Parameters:

  | pNode | [in] Pointer to object that is inspected for presence of environment object.

Returns:
  ppEnvObj [out, retval] Pointer to environment object:
  - NULL if no phys object is found.

  standard HRESULT processing can be applied to returned value.

HRESULT IRfPhysHelper::DisableInSceneOctree | ( | [in] IRsNode * | pNode,
|  | [in] RtBool | bDisable |
| ) |  |  |

Disable/enable object to be considered in octree data.

Parameters:

  | pNode | [in] Pointer to object.
  | bDisable | [in] TRUE disable, FALSE enable.

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

HRESULT IRfPhysHelper::GetObjectVolume | ( | [in] IRsNode * | pNode,
|  | [out, retval] RtFloat * | volume |
| ) |  |  |

Returns volume of object.

Parameters:

  | pNode | [in] Pointer to object.

Returns:
  volume [out, retval] volume of pNode.

  standard HRESULT processing can be applied to returned value.

HRESULT IRfPhysHelper::GetObjectInvariant | ( | [in] IRsNode * | pNode,
|  | [in] int | bLocal,
|  | [out] IRdMatrixf ** | ppInertia,
|  | [out] float * | pVolume,
|  | [out] RtPoint * | pCog |
| ) |  |  |

Returns invariant phys properties of object such as mass, volume and intertia.

Parameters:

  | pNode | [in] Pointer to object.
  | bLocal | [in] If TRUE, inertia and cog are in local object's coordinate system,if FALSE, they are in world coordinate system.
  | ppInertia | [out] Pointer to inertia data, if ppInertia is NULL, no value is returned.
  | pVolume | [out] Pointer to volume data, if pVolume is NULL,no value is returned.
  | pCog | [out] Centre of gravity, if pCog is NULL, no value is returned.

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

HRESULT IRfPhysHelper::GetBBox | ( | [in] IRsNode * | pNode,
|  | [out] RtFloat * | box |
| ) |  |  |

Returns bounding box of object.

Parameters:

  | pNode | [in] Pointer to object.
  | box | [out] Float array with bounding box values: b[0]=xmin, b[1] = xmax,......,b[5]=zmax.

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

HRESULT IRfPhysHelper::GetCollisionResponse | ( | [in] IRsNode * | pNode,
|  | [in] IRdCollInfo * | pColl,
|  | [out] RtPoint * | pSpeed,
|  | [out] RtPoint * | pRotation |
| ) |  |  |

Returns response for phys object at collisions.

Parameters:

  | pNode | [in] Pointer to object.
  | pColl | [in] Collision data for objects.
  | pSpeed | [out] Speed of object at the time of collision: Returned value is speed after collision.
  | pRotation | [out] Rotation of object at the time of collision: Returned value is rotation after collision.

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

HRESULT IRfPhysHelper::UpdateObjPosition | ( | [in] IRsNode * | pNode,
|  | [in] RtPoint * | pSpeed,
|  | [in] RtPoint * | pRotation,
|  | RtFloat | time |
| ) |  |  |

Update position of object according its speed and rotation.

Parameters:

  | pNode | [in] Pointer to object.
  | pSpeed | [in] Speed of object.
  | pRotation | [in] Rotation of object.
  | time | [in] Integration time step.

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

HRESULT IRfPhysHelper::MovePhysObject | ( | [in] IRsNode * | pNode,
|  | [in] float | deltatime |
| ) |  |  |

Update position of specified object with phys attr according to it's phys attributes.

- Method considers collisions when object's shift is calculated.

Parameters:

  | pNode | [in] Pointer to object.
  | deltatime | [in] Integration time step.

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

HRESULT IRfPhysHelper::SetFixPoint | ( | [in] IRsNode * | pNode,
|  | [in] RtPoint | p |
| ) |  |  |

Sets object's fixation to one point.

Parameters:

  | pNode | [in] Pointer to object.
  | p | [in] Fixation point

Returns:
  standard HRESULT processing can be applied to returned value

HRESULT IRfPhysHelper::SetFixPoints | ( | [in] IRsNode * | pNode,
|  | [in] RtPoint | p1,
|  | [in] RtPoint | p2 |
| ) |  |  |

Sets object's fixation to two points.

Parameters:

  | pNode | [in] Pointer to object.
  | p1 | [in] First fixation point
  | p2 | [in] Second fixation point

Returns:
  standard HRESULT processing can be applied to returned value

HRESULT IRfPhysHelper::RemoveFixation | ( | [in] IRsNode * | pNode | ) |

Removes object's fixation.

Parameters:

  | pNode | [in] Pointer to object.

Returns:
  standard HRESULT processing can be applied to returned value

HRESULT IRfPhysHelper::GetFixPoints | ( | [in] IRsNode * | pNode,
|  | [out] RtUlong * | pNumfix,
|  | [out] RtPoint * | pP1,
|  | [out] RtPoint * | pP2 |
| ) |  |  |

Gets object's fixation points

Parameters:

  | pNode | [in] Pointer to object.
  | pNumfix | [out] Number of fixation points: Returned value is number of fixation points.
  | pP1 | [out] First fixation point: Returned value is first fixation point.
  | pP2 | [out] Second fixation point: Returned value is second fixation point.

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