Skip to main content

Engine Events

This module contains the Interhaptics GameMaker extension 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.

Articles​

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 offsets. If the source does not already exist, it will be created.

Syntax:

interhaptics_play_event(material_ref, vibration_offset, texture_offset, stiffness_offset)
ArgumentTypeDescription
material_refRealThe ID of the source to play, which is the same as the attached haptic effect.
vibration_offsetRealThe vibration offset for the source.
texture_offsetRealThe texture offset for the source.
stiffness_offsetRealThe stiffness offset for the source.

Returns:

N/A

interhaptics_stop_event​

This function stops the rendering playback of a haptic source.

Syntax:

interhaptics_stop_event(material_ref)
ArgumentTypeDescription
material_refRealThe ID of the source to stop, which is the same as the attached haptic effect.

Returns:

N/A

interhaptics_stop_all_events​

This function stops the rendering playback of all haptic sources.

Syntax:

interhaptics_stop_all_events()

Returns:

N/A

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)
ArgumentTypeDescription
material_refRealThe ID of the source to add a target to, which is the same as the attached haptic effect.
targetArray of Interhaptics_CommandDataA target contains a group of body parts, lateral flags, and exclusion flags.

Returns:

N/A

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)
ArgumentTypeDescription
material_refRealThe ID of the source to add a target to, which is the same as the attached haptic effect.
targetArray of Interhaptics_CommandDataAn 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

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)
ArgumentTypeDescription
material_refRealThe ID of the source to remove all targets from, which is the same as the attached haptic effect.

Returns:

N/A

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)
ArgumentTypeDescription
current_timeRealThe current time in seconds.

Returns:

N/A

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)
ArgumentTypeDescription
material_refRealThe ID of the source, which is the same as the attached haptic effect.
targetArray of Interhaptics_CommandDataA 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_positionRealThe new texture position.
stiffness_positionRealThe new stiffness position.

Returns:

N/A

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)
ArgumentTypeDescription
material_refRealThe ID of the source, which is the same as the attached haptic effect.
vibration_offsetRealThe vibration offset.
texture_offsetRealThe texture offset.
stiffness_offetRealThe stiffness offset.

Returns:

N/A

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

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

interhaptics_clear_event​

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

Syntax:

interhaptics_clear_event(material_ref)
ArgumentTypeDescription
material_refRealThe ID of the source, which is the same as the attached haptic effect.

Returns:

N/A

interhaptics_set_event_intensity​

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

Syntax:

interhaptics_set_event_intensity(material_ref, intensity)
ArgumentTypeDescription
material_refRealThe ID of the source, which is the same as the attached haptic effect.
intensityRealThe intensity factor value. Always clamped above 0.

Returns:

N/A

interhaptics_set_event_loop​

This function sets the loop flag for a specific source.

Syntax:

interhaptics_set_event_loop(material_ref, number_of_loops)
ArgumentTypeDescription
material_refRealThe ID of the source, which is the same as the attached haptic effect.
number_of_loopsRealThe number of loops for the event. <= is one iteration.

Returns:

N/A

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)
ArgumentTypeDescription
material_refRealThe ID of the source, which is the same as the attached haptic effect.
targetArray of Interhaptics_CommandDataThe target to change intensity.
intensityRealThe intensity factor value. Always clamped above 0.

Returns:

N/A