Controls haptic feedback for an XR controller. 更多...
| import 语句: |
import QtQuick3D.Xr
|
| Since: | Qt 6.9 |
| 继承: | |
| 状态: | 技术预览 |
Haptic feedback typically involves applying a short vibration to a controller to provide a tactile experience when an event happens. This can give the illusion of touching a button, for example.
There are two ways of using XrHapticFeedback:
The following code makes the right-hand controller vibrate when the value of the
someObject.hit
property changes from
false
to
true
:
XrHapticFeedback { controller: XrHapticFeedback.RightController condition: XrHapticFeedback.RisingEdge trigger: someObject.hit hapticEffect: XrSimpleHapticEffect { amplitude: 0.5 duration: 300 frequency: 3000 } }
|
条件
:
enumeration
|
The condition for triggering this haptic feedback.
This property specifies how the trigger property is interpreted
It can be one of:
| 常量 | 描述 |
|---|---|
XrHapticFeedback.RisingEdge
|
The haptic effect starts when
trigger
改变从
false
to
true
.
|
XrHapticFeedback.TrailingEdge
|
The haptic effect starts when
trigger
改变从
true
to
false
.
|
|
controller : enumeration |
The Controller that this haptic feedback will apply to.
It can be one of:
| 常量 | 值 |
|---|---|
XrHapticFeedback.LeftController
|
|
XrHapticFeedback.RightController
|
|
XrHapticFeedback.UnknownController
|
|
hapticEffect : XrHapticEffect |
This property describes the effect that is applied to the controller when the haptic feedback is triggered.
|
trigger : bool |
Trigger for the haptic feedback
This property defines what the haptic effect will react to. The 条件 property determines how the trigger is interpreted.
|
void start () |
Starts the haptic feedback effect
|
void stop () |
Stops the haptic feedback effect