Skip to main content

Engine Control

This module contains the functions related to Engine Control.

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_init

This function initialises the different components and modules of the Interhaptics Engine:

  • Haptic Material Manager: module in charge of loading and storing haptic effects
  • Human Avatar Manager: module in charge of mapping between device, human avatar, and experience
  • Haptic Event Manager: module in charge of the control of haptic sources

Syntax:

interhaptics_init()

Returns:

Boolean

interhaptics_quit

This function cleans up the different components and modules of the Interhaptics Engine. To be called before the application is quit.

Syntax:

interhaptics_quit()

Returns:

N/A

interhaptics_set_global_intensity

This function sets the global rendering intensity factor for the whole engine.

Syntax:

interhaptics_set_global_intensity(intensity)
ArgumentTypeDescription
intensityRealA positive value. 0 is nothing. Base value is 1.

Returns:

N/A

interhaptics_get_global_intensity

This function gets the global rendering intensity factor for the whole engine.

It returns the global intensity, or -1 if the mixer is not initialised.

Syntax:

interhaptics_get_global_intensity()

Returns:

Real

interhaptics_add_hm

This function adds the content of an .haps file to the Interhaptics Engine for future use. It returns a reference to the new haptic effect to be used in other functions.

Syntax:

interhaptics_add_hm(content)
ArgumentTypeDescription
contentStringThe JSON content of the .haps file to be loaded. This needs to follow the Interhaptics .haps format.

Returns:

Real

interhaptics_add_parametric_effect

This function creates a haptic effect by processing parameters such as amplitude, pitch, and transients. This function generates a haptic effect based on the given input parameters and can optionally loop it.

It returns the ID of the haptic effect created.

Syntax:

interhaptics_add_parametric_effect(amplitude, pitch, freq_min, freq_max, transient, is_looping)
ArgumentTypeDescription
amplitudeArray of RealAn array of amplitude values. Should be formatted as Time -- Value pairs. Value is between 0 and 1.
pitchArray of RealAn array of pitch values. Should be formatted as Time -- Value pairs. Value is between 0 and 1.
freq_minRealThe minimum value for the frequency range.
freq_maxRealThe maximum value for the frequency range.
transientArray of RealAn array of transient values. The array should be formatted as Time -- Amplitude -- Pitch triplets, with both Amplitude and Pitch values ranging between 0 and 1.
is_loopingBooleanIndicates whether the effect should loop or not.

Returns:

Real

interhaptics_delete_hm

This function deletes an existing haptic effect.

Syntax:

interhaptics_delete_hm(material_ref)
ArgumentTypeDescription
material_refRealThe ID of the haptic effect to delete.

Returns:

N/A

interhaptics_update_hm

This function replaces the content of an already loaded haptic effect and returns whether the replace was successful. This can be useful when the ID of the haptic effect needs to be persistent.

Syntax:

interhaptics_update_hm(material_ref, content)
ArgumentTypeDescription
material_refRealID of the haptic effect to be replaced.
contentStringThe JSON content of the .haps file to be loaded. This needs to follow the Interhaptics .haps format.

Returns:

Boolean