Difference between revisions of "Global Command: createHapticEffectLeftRight"

From The Official Visionaire Studio: Adventure Game Engine Wiki
(Created page with "Create a haptic left/right effect for devices which support haptic effects. {| class="ts" |- | style="width:15%" | Related functions | Global Command: createHapticEffectCon...")
 
 
Line 53: Line 53:
 
== Examples ==
 
== Examples ==
  
'''Example 1:''' Create a constant haptic effect and start it.
+
'''Example 1:''' Create a haptic left/right effect and start it.
 
<syntaxhighlight lang="lua">
 
<syntaxhighlight lang="lua">
 
local effectID = createHapticEffectLeftRight('leftright', 5000, 0x3000, 0xFFFF)
 
local effectID = createHapticEffectLeftRight('leftright', 5000, 0x3000, 0xFFFF)

Latest revision as of 11:32, 5 August 2023

Create a haptic left/right effect for devices which support haptic effects.

Related functions createHapticEffectCondition | createHapticEffectConstant | createHapticEffectPeriodic | createHapticEffectRamp | startHapticEffect | startHapticRumble | stopHapticEffect | stopHapticRumble


Syntax

createHapticEffectLeftRight(effectType, length, large_magnitude, small_magnitude)


Parameters

Parameter Type Description
effectType string Type of the effect. Supported values:
  • leftright
length int Duration of the effect in milliseconds
large_magnitude int Control of the large controller motor
small_magnitude int Control of the small controller motor


Return values

Type Description
integer The unique id of the effect or -1 if the effect is not supported by the controller.


Examples

Example 1: Create a haptic left/right effect and start it.

local effectID = createHapticEffectLeftRight('leftright', 5000, 0x3000, 0xFFFF)
startHapticEffect(effectID)