Skip to main content

Engine Events

Articles

PlayEvent

void PlayEvent(int _hMaterialID, double _vibrationOffset, double _textureOffset, double _stiffnessOffset);

Starts the rendering playback of a haptic source. It sets the starting time to 0 plus different offsets. If the event is already playing, it restarts with the new offsets. If the source does not already exist, it will be created.

Parameters

  • _hMaterialID: ID of the source to play, which is the same as the attached haptic effect.
  • _vibrationOffset: Vibration offset for the source.
  • _textureOffset: Texture offset for the source.
  • _stiffnessOffset: Stiffness offset for the source.

StopEvent

void StopEvent(int _hMaterialID);

Stops the rendering playback of a haptic source.

Parameters

  • _hMaterialID: ID of the source to stop, which is the same as the attached haptic effect.

StopAllEvents

void StopAllEvents();
  • Stops the rendering playback of all haptic sources.

AddTargetToEvent

void AddTargetToEvent(int _hMaterialID, std::vector<CommandData> _target);

Adds a target within the range of the source. The Interhaptics Engine will remap device endpoints and in-range targets to the device management layer for haptic playback.

Parameters

  • _hMaterialID: ID of the source to add a target to, which is the same as the attached haptic effect.
  • _target: Vector of CommandData to build a target. A target contains a group of body parts, lateral flags, and exclusion flags.

AddTargetToEventMarshal

void AddTargetToEventMarshal(int _hMaterialID, CommandData* _target, int _size);

Marshal version of the AddTargetToEvent function. Adds a target within the range of the source. The Interhaptics Engine will remap device endpoints and in-range targets to the device management layer for haptic playback.

Parameters

  • _hMaterialID: ID of the source to add a target to, which is the same as the attached haptic effect.
  • _target: Pointer of CommandData to build a target. A target contains a group of body parts, lateral flags, and exclusion flags. Memory must be allocated before calling this entry point.
  • _size: Size of the _target array.

RemoveTargetFromEvent

void RemoveTargetFromEvent(int _hMaterialID, std::vector<CommandData> _target);

Removes a target from a source range. The Interhaptics Engine will remap device endpoints and in-range targets to the device management layer for haptic playback.

Parameters

  • _hMaterialID: ID of the source to remove a target from, which is the same as the attached haptic effect.
  • _target: Vector of CommandData to build a target. A target contains a group of body parts, lateral flags, and exclusion flags. Only perfectly matching targets will be removed.

RemoveTargetFromEventMarshal

void RemoveTargetFromEventMarshal(int _hMaterialID, CommandData* _target, int _size);

Marshal version of the RemoveTargetFromEvent function. Removes a target from a source range. The Interhaptics Engine will remap device endpoints and in-range targets to the device management layer for haptic playback.

Parameters

  • _hMaterialID: ID of the source to remove a target from, which is the same as the attached haptic effect.
  • _target: Pointer of CommandData to build a target. A target contains a group of body parts, lateral flags, and exclusion flags. Only perfectly matching targets will be removed. Memory must be allocated before calling this entry point.
  • _size: Size of the _target array.

RemoveAllTargetsFromEvent

void RemoveAllTargetsFromEvent(int _hMaterialID);

Removes all targets from a source range. The Interhaptics Engine will remap device endpoints and in-range targets to the device management layer for haptic playback.

Parameters

  • _hMaterialID: ID of the source to remove all targets from, which is the same as the attached haptic effect.

ComputeAllEvents

void ComputeAllEvents(double _curTime);

To be called in the application main loop to trigger the rendering of all haptic buffers at a specific time. The Interhaptics Engine will compare the current time with the last known value to build a buffer large enough to cover frame drops. This function can be called from the main thread or in a parallel loop. It must be called at least once before triggering the device update event.

Parameters

  • _curTime: Current time in seconds.

UpdateEventPositions

void UpdateEventPositions(int _hMaterialID, std::vector<CommandData> _target, double _texturePosition, double _stiffnessPosition);

Updates spatial positions for a specific source target.

Parameters

  • _hMaterialID: ID of the source, which is the same as the attached haptic effect.
  • _target: Vector of CommandData to build a target. A target contains a group of body parts, lateral flags, and exclusion flags. Only perfectly matching targets will be updated.
  • _texturePosition: New texture position.
  • _stiffnessPosition: New stiffness position.

UpdateEventPositionsMarshal

void UpdateEventPositionsMarshal(int _hMaterialID, CommandData* _target, int _size, double _texturePosition, double _stiffnessPosition);

Marshal version of the UpdateEventPositions function. Updates spatial positions for a specific source target.

Parameters

  • _hMaterialID: ID of the source, which is the same as the attached haptic effect.
  • _target: Pointer of CommandData to build a target. A target contains a group of body parts, lateral flags, and exclusion flags. Only perfectly matching targets will be updated. Memory must be allocated before calling this function.
  • _size: Size of the _target array.
  • _texturePosition: New texture position.
  • _stiffnessPosition: New stiffness position.

SetEventIntensity

void SetEventIntensity(int _hMaterialID, double _intensity);
  • Sets the haptics intensity factor for a specific haptic source.

Parameters

  • int _hMaterialID: The identifier of the haptic effect.
  • double _intensity: The new intensity factor for the haptic effect, which is always clamped to be above 0.

SetTargetIntensity

void SetTargetIntensity(int _hMaterialID, std::vector<CommandData> _target, double _intensity);

Sets the haptics intensity factor for a specific target within a haptic source.

Parameters

  • int _hMaterialID: The identifier of the haptic source.
  • std::vector<CommandData> _target: The target for the intensity change.
  • double _intensity: The new intensity factor for the target, always clamped to be above 0.

SetTargetIntensityMarshal

void SetTargetIntensityMarshal(int _hMaterialID, CommandData* _target, int _size, double _intensity);
  • Sets the haptics intensity factor for a specific target of a source using a marshaling technique.

Parameters

  • int _hMaterialID: The identifier of the haptic source.
  • CommandData _target*: The pointer to the target data array.
  • int _size: The size of the target data array.
  • double _intensity: The new intensity factor for the target, always clamped to be above 0.

SetEventLoop

void SetEventLoop(int _hMaterialID, bool _isLooping);

Sets the loop flag for a specific haptic effect.

Parameters

  • int _hMaterialID: The identifier of the haptic effect.
  • bool _isLooping: A boolean value indicating whether the haptic effect should loop.

SetEventOffsets

void SetEventOffsets(int _hMaterialID, double _vibrationOffset, double _textureOffset, double _stiffnessOffset);

Sets the offsets for a specific haptic source.

Parameters

  • _hMaterialID: ID of the source, which is the same as the attached haptic effect.
  • _vibrationOffset: Vibration offset.
  • _textureOffset: Texture offset.
  • _stiffnessOffset: Stiffness offset.

ClearInactiveEvents

void ClearInactiveEvents();

Clears all inactive sources from memory. Inactive sources are kept in memory to avoid deletion and re-creation when playing and stopping a source.

ClearActiveEvents

void ClearActiveEvents();

Clears all active sources from memory. Deleted sources can be recreated by calling the PlayEvent function.

ClearEvent

void ClearEvent(int _hMaterialID);

Clears a specific haptic source, whether it is active or not.

Parameters:

  • _hMaterialID: ID of the source, which is the same as the attached haptic effect.