Skip to content

engine_events

Francisco Dias edited this page Sep 4, 2024 · 3 revisions

Engine Events

Interhaptics Docs Section: Engine Events


This module contains the functions related to Engine Events.

Functions

This module offers a collection of functions designed to address specific tasks and provide utilities for various purposes. Explore the available functions to make the most of the functionalities provided by this module.



Back To Top

interhaptics_play_event

This function starts the rendering playback of a haptic source. Sets the starting time to 0 + different offsets. If the event is already playing, it restarts with the new offets. If the source does not already exist, it will be created.


Syntax:

interhaptics_play_event(material_ref, vibration_offset, texture_offset, stiffness_offset)
Argument Type Description
material_ref Real The ID of the source to play, which is the same as the attached haptic effect.
vibration_offset Real The vibration offset for the source.
texture_offset Real The texture offset for the source.
stiffness_offset Real The stiffness offset for the source.



Returns:

N/A




Back To Top

interhaptics_stop_event

This function stops the rendering playback of a haptic source.


Syntax:

interhaptics_stop_event(material_ref)
Argument Type Description
material_ref Real The ID of the source to stop, which is the same as the attached haptic effect.



Returns:

N/A




Back To Top

interhaptics_stop_all_events

This function stops the rendering playback of all haptic sources.


Syntax:

interhaptics_stop_all_events()



Returns:

N/A




Back To Top

interhaptics_add_target_to_event

This 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.


Syntax:

interhaptics_add_target_to_event(material_ref, target)
Argument Type Description
material_ref Real The ID of the source to add a target to, which is the same as the attached haptic effect.
target Array of Interhaptics_CommandData A target contains a group of body parts, lateral flags, and exclusion flags.



Returns:

N/A




Back To Top

interhaptics_remove_target_from_event

This 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.


Syntax:

interhaptics_remove_target_from_event(material_ref, target)
Argument Type Description
material_ref Real The ID of the source to add a target to, which is the same as the attached haptic effect.
target Array of Interhaptics_CommandData An array of Interhaptics_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.



Returns:

N/A




Back To Top

interhaptics_remove_all_targets_from_event

This function 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.


Syntax:

interhaptics_remove_all_targets_from_event(material_ref)
Argument Type Description
material_ref Real The ID of the source to remove all targets from, which is the same as the attached haptic effect.



Returns:

N/A




Back To Top

interhaptics_compute_all_events

This function must 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.


Syntax:

interhaptics_compute_all_events(current_time)
Argument Type Description
current_time Real The current time in seconds.



Returns:

N/A




Back To Top

interhaptics_update_event_positions

This function updates the spatial positions for a specific source target.


Syntax:

interhaptics_update_event_positions(material_ref, target, texture_position, stiffness_position)
Argument Type Description
material_ref Real The ID of the source, which is the same as the attached haptic effect.
target Array of Interhaptics_CommandData A vector of Interhaptics_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.
texture_position Real The new texture position.
stiffness_position Real The new stiffness position.



Returns:

N/A




Back To Top

interhaptics_set_event_offsets

This function sets the offsets for a specific haptic source.


Syntax:

interhaptics_set_event_offsets(material_ref, vibration_offset, texture_offset, stiffness_offet)
Argument Type Description
material_ref Real The ID of the source, which is the same as the attached haptic effect.
vibration_offset Real The vibration offset.
texture_offset Real The texture offset.
stiffness_offet Real The stiffness offset.



Returns:

N/A




Back To Top

interhaptics_clear_inactive_events

This function clears all inactive sources from memory. Inactive sources are kept in memory to avoid deletion and creation when playing and stopping a source.


Syntax:

interhaptics_clear_inactive_events()



Returns:

N/A




Back To Top

interhaptics_clear_active_events

This function clears all active sources from memory. Deleted sources can be recreated by calling the interhaptics_play_event function.


Syntax:

interhaptics_clear_active_events()



Returns:

N/A




Back To Top

interhaptics_clear_event

This function clears a specific haptic source, whether it is active or not.


Syntax:

interhaptics_clear_event(material_ref)
Argument Type Description
material_ref Real The ID of the source, which is the same as the attached haptic effect.



Returns:

N/A




Back To Top

interhaptics_set_event_intensity

This function sets the haptics intensity factor for a specific source.


Syntax:

interhaptics_set_event_intensity(material_ref, intensity)
Argument Type Description
material_ref Real The ID of the source, which is the same as the attached haptic effect.
intensity Real The intensity factor value. Always clamped above 0.



Returns:

N/A




Back To Top

interhaptics_set_event_loop

This function sets the loop flag for a specific source.


Syntax:

interhaptics_set_event_loop(material_ref, number_of_loops)
Argument Type Description
material_ref Real The ID of the source, which is the same as the attached haptic effect.
number_of_loops Real The number of loops for the event. <= 1 is one iteration.



Returns:

N/A




Back To Top

interhaptics_set_target_intensity

This function sets the haptics intensity factor for a specific target of a source.


Syntax:

interhaptics_set_target_intensity(material_ref, target, intensity)
Argument Type Description
material_ref Real The ID of the source, which is the same as the attached haptic effect.
target Array of Interhaptics_CommandData The target to change intensity.
intensity Real The intensity factor value. Always clamped above 0.



Returns:

N/A