XrHapticFeedback QML Type
控制 XR 控制器的手感反馈。更多内容...
| Import Statement: | import QtQuick3D.Xr |
| Since: | Qt 6.9 |
| Inherits: | |
| Status: | Technology preview |
此类型处于技术预览阶段,可能会有变动。
属性
- condition : enumeration
- controller : enumeration
- hapticEffect : XrHapticEffect
- trigger : bool
方法
详细说明
触觉反馈通常是指在发生某种事件时,通过向控制器施加短暂的振动来提供触觉体验。例如,这可以营造出按下的错觉。
使用 XrHapticFeedback 有两种方式:
以下代码会在someObject.hit 属性的值从false 变为true 时,使右手控制器产生振动:
XrHapticFeedback {
controller: XrHapticFeedback.RightController
condition: XrHapticFeedback.RisingEdge
trigger: someObject.hit
hapticEffect: XrSimpleHapticEffect {
amplitude: 0.5
duration: 300
frequency: 3000
}
}属性文档
condition : enumeration [default: XrHapticFeedback.RisingEdge]
触发此触觉反馈的条件。
此属性指定如何解释 `trigger ` 属性
它可以是以下选项之一:
| 常量 | 描述 |
|---|---|
XrHapticFeedback.RisingEdge | 当 `trigger ` 从 `false ` 变为 `true` 时,触觉效果开始。 |
XrHapticFeedback.TrailingEdge | 当trigger 从true 变为false 时,触觉效果开始。 |
controller : enumeration
此触觉反馈将作用于该控制器。
它可以是以下之一:
| 常量 | 值 |
|---|---|
XrHapticFeedback.LeftController | |
XrHapticFeedback.RightController | |
XrHapticFeedback.UnknownController |
hapticEffect : XrHapticEffect
此属性描述了在触发触觉反馈时应用于控制器的效果。
trigger : bool
触觉反馈的触发条件
此属性定义了触觉效果将对什么做出反应。condition 属性决定了触发条件的解释方式。
方法文档
void start()
启动触觉反馈效果。
void stop()
停止触觉反馈效果。
© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.