XrHapticFeedback QML Type

控制 XR 控制器的触觉反馈。更多

Import Statement: import QtQuick3D.Xr
Since: Qt 6.9
Inherits:

QtObject

Status: Technical Preview

属性

方法

详细说明

触觉反馈通常是在发生事件时,对控制器施加短时振动,以提供触觉体验。例如,这可以让人产生触摸按钮的错觉。

使用 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.RisingEdgetriggerfalse 变为true 时,触觉效果开始。
XrHapticFeedback.TrailingEdgetriggertrue 变为false 时,触觉效果开始。

controller : enumeration

该触觉反馈适用的控制器。

可以是

常量
XrHapticFeedback.LeftController
XrHapticFeedback.RightController
XrHapticFeedback.UnknownController

hapticEffect : XrHapticEffect

该属性描述触觉反馈触发时应用于控制器的效果。


trigger : bool

触觉反馈触发器

该属性定义触觉效果的反应。condition 属性决定如何解释触发器。

另请参阅 startcondition


方法文档

void start()

启动触觉反馈效果


void stop()

停止触觉反馈效果


© 2025 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.