Skip to main content

MotionController.HapticFeedback

Enum

Defines a set of haptic feedback patterns that can be requested.

  • Snapchat: not supported
  • SPECS: fully supported
  • Camera Kit Web: not supported
  • Camera Kit Mobile: not supported
  • SnapchatNot supported — SPECS only
  • SPECSFully supported
  • Camera Kit WebNot supported — SPECS only
  • Camera Kit MobileNot supported — SPECS only

Platform details

  • Snapchat — Not supported — SPECS only.

  • SPECS — Fully supported.

  • Camera Kit Web — Not supported — SPECS only.

  • Camera Kit Mobile — Not supported — SPECS only.

Defines a set of haptic feedback patterns that can be requested.

Index

Example

const MotionControllerModule = require("LensStudio:MotionControllerModule")

@component
export class NewScript extends BaseScriptComponent {

private controller: MotionController
private feedbackId: number = 0

onAwake() {
var options = MotionController.Options.create()
options.motionType = MotionController.MotionType.SixDoF

this.controller = MotionControllerModule.getController(options)

this.controller.onTouchEvent.add(this.testHapticFeedback.bind(this));
}
testHapticFeedback(normalizedPosition, touchId, timestampMs, phase) {

if (phase != MotionController.TouchPhase.Began) {
//we only want to trigger the feedback on touch start
return;
}
this.feedbackId = (this.feedbackId + 1) % 8
var request = MotionController.HapticRequest.create()
switch (this.feedbackId) {
case 0:
request.hapticFeedback = MotionController.HapticFeedback.Default
print("Default")
break
case 1:
request.hapticFeedback = MotionController.HapticFeedback.Tick
print("Tick")
break
case 2:
request.hapticFeedback = MotionController.HapticFeedback.Select
print("Select")
break
case 3:
request.hapticFeedback = MotionController.HapticFeedback.Success
print("Success")
break
case 4:
request.hapticFeedback = MotionController.HapticFeedback.Error
print("Error")
break
case 5:
request.hapticFeedback = MotionController.HapticFeedback.VibrationLow
print("Vibration Low")
break
case 6:
request.hapticFeedback = MotionController.HapticFeedback.VibrationMedium
print("Vibration Medium")
break
case 7:
request.hapticFeedback = MotionController.HapticFeedback.VibrationHigh
print("Vibration High")
break
default:
print("Unknown feedbackId = " + this.feedbackId)
}
request.duration = 0.3
this.controller.invokeHaptic(request)
}
}

Enumeration Members

Default

Default: number

SPECS only

Default value, same as Tick.


Error

Error: number

SPECS only

A negative haptic pattern indicating that an action failed or encountered an issue.


Select

Select: number

SPECS only

A subtle haptic effect used to confirm a selection or interaction.


Success

Success: number

SPECS only

A positive haptic pattern indicating that an action was completed successfully.


Tick

Tick: number

SPECS only

A brief, single haptic effect that simulates a ticking or clicking sensation.


VibrationHigh

VibrationHigh: number

SPECS only

A strong vibration for more pronounced feedback.


VibrationLow

VibrationLow: number

SPECS only

A gentle vibration for less intense feedback.


VibrationMedium

VibrationMedium: number

SPECS only

A moderate vibration for standard feedback intensity.