vrImmersiveInteractionService

vrImmersiveInteractionService

(继承 vrBaseService

通过此服务可管理 VRED 中内置的所有沉浸式设备交互。此服务包含用于激活或取消激活这些交互以及调整其设置的方法。

摘要

函数:
信号:

函数

vrImmersiveInteractionService.activateGroundCalibrationMode(rightHand)

开始校准地面。

参数:rightHand (bool) -

vrImmersiveInteractionService.createMultiMarker(multiMarkerName, markerNames, markerType)

通过平均化多个常规标记的姿势创建一个多标记。

参数:
  • multiMarkerName (string) - 多标记将使用的名称。可以自由选择
  • markerNames (List[string]) - 多标记将包含的标记的名称
  • markerType (vrXRealityTypes.MarkerTypes) - 多标记将包含的标记的类型
返回值:

返回值类型:

vrdMultiMarker

vrImmersiveInteractionService.getActiveHMDSupportsHandTracking()

返回值:

如果支持手部跟踪,则为 True

返回值类型:

bool

vrImmersiveInteractionService.getAutoCreateCollisionObjects()

返回是否自动创建碰撞对象。

返回值:如果自动创建碰撞对象,则为 True。
返回值类型:bool

vrImmersiveInteractionService.getControllerVisualizationMode()

返回当前控制器可视化模式。

返回值:当前可视化模式
返回值类型:vrVRInputDeviceTypes.VisualizationMode

vrImmersiveInteractionService.getControlMode()

返回当前控制模式。

返回值:当前控制模式
返回值类型:vrImmersiveInteractionTypes.ControlMode

vrImmersiveInteractionService.getDetectedMarkers(markerType)

获取所有检测到的给定类型的标记。

参数:markerType (vrXRealityTypes.MarkerTypes) - 标记的类型
返回值:检测到的标记
返回值类型:List[vrdMarker]

vrImmersiveInteractionService.getHandTrackingEnabled()
返回值:如果已启用手部跟踪,则为 True
返回值类型:bool

vrImmersiveInteractionService.getHandTrackingOffset()
返回值:从头部到跟踪器的跟踪偏移
返回值类型:QMatrix4x4

vrImmersiveInteractionService.getHandTrackingType()
返回值:当前手部跟踪类型
返回值类型:vrHandTypes.HandTrackingType

vrImmersiveInteractionService.getMarker(name, markerType)

获取已检测到的标记。

参数:
返回值:

标记,如果未检测到名称和类型组合,则为空标记

返回值类型:

vrdMarker

vrImmersiveInteractionService.getMinMarkerConfidence()

另请参见:setMinMarkerConfidence。

返回值:最低标记置信度
返回值类型:float

vrImmersiveInteractionService.getPointerRayScaleRange()
返回值:指针光线比例范围 [min, max]。值 1.0 等于 100% 缩放。
返回值类型:QVector2D

vrImmersiveInteractionService.getPointerScalingDistance()
返回值:以场景单位表示的指针缩放距离
返回值类型:float

vrImmersiveInteractionService.getPointerSphereScaleRange()
返回值:指针球体比例范围 [min, max]。值 1.0 等于 100% 缩放。
返回值类型:QVector2D

vrImmersiveInteractionService.getPreferredTooltipsMode()

返回是否在启动时显示工具提示。

返回值:如果必须显示工具提示,则为 True
返回值类型:bool

vrImmersiveInteractionService.getRelativeTeleportOrientation()

返回从手腕的绝对旋转还是相对旋转获取方向角度。

返回值:指示是否应使用相对旋转的标志
返回值类型:bool

vrImmersiveInteractionService.getShowTrackedHandsInMR()
返回值:如果跟踪的手部可视化在混合现实模式中显示,则为 True
返回值类型:bool

vrImmersiveInteractionService.getTeleportAvailability()

获取传送可用的渲染模式。

返回值:支持的模式
返回值类型:List[vrXRealityTypes.XRRenderMode]

vrImmersiveInteractionService.getTeleportGroundHeight()

返回在“在地平面上”传送模式下使用的地平面的高度。

返回值:以场景单位表示的地面高度
返回值类型:float

vrImmersiveInteractionService.getTeleportGroundMode()

返回当前传送地面模式。

返回值:地面模式
返回值类型:vrImmersiveInteractionTypes.TeleportGroundMode

vrImmersiveInteractionService.getTeleportRange()

返回最大传送距离。

返回值:以场景单位表示的最大距离
返回值类型:float

vrImmersiveInteractionService.getUseBoundingBoxCollisionObjects()

返回是否将边界框碰撞对象用于自动创建的碰撞对象。

返回值:如果使用边界框碰撞对象,则为 true;如果使用凸面外壳线碰撞对象,则为 false
返回值类型:bool

vrImmersiveInteractionService.hideControllerMessage(message)

隐藏控制器消息。

参数:message (vrdNode) - 消息的 vrdNode

vrImmersiveInteractionService.isHandTrackingGestureEnabled(message)

获取在手部跟踪处于活动状态时 VRED 是否检测手势。

参数:
  • gesture (vrHandTypes.HandTrackingGesture) - 要检查的手势
  • leftHand (bool) - True 表示左手的手势,False 表示右手的手势
返回值:如果手势处于启用状态,则为 True,否则为 False
返回值类型:bool

vrImmersiveInteractionService.isHmdActive()

检查 HMD(虚拟现实)显示模式是否处于活动状态。

返回值:如果处于 HMD 模式,则为 True
返回值类型:bool

vrImmersiveInteractionService.pickingMoved(hit)

触发指针移动事件。

参数:hit (vrdRayIntersection) - 光线相交对象。

vrImmersiveInteractionService.pickingPressed(hit)

触发指针按钮按下事件。

参数:hit (vrdRayIntersection) - 光线相交对象。

vrImmersiveInteractionService.pickingReleased(hit)

触发指针按钮释放事件。

参数:hit (vrdRayIntersection) - 光线相交对象。

vrImmersiveInteractionService.setAutoCreateCollisionObjects(automatic)

切换点击传感器和 Web 引擎的碰撞对象创建。

参数:automatic (bool) - 启用自动创建。

vrImmersiveInteractionService.setControllerVisualizationMode(mode)

设置 HMD 控制器的可视化模式。

参数:mode (vrVRInputDeviceTypes.VisualizationMode) - 可视化模式

vrImmersiveInteractionService.setControlMode(mode)

设置沉浸式交互的控制模式及相应的按钮映射。

参数:mode (vrImmersiveInteractionTypes.ControlMode) - 控制模式

vrImmersiveInteractionService.setDefaultInteractionsActive(active)

激活或取消激活所有内置交互工具(传送、指针)。

参数:active (bool) - 为 True 时激活,为 False 时取消激活。

vrImmersiveInteractionService.setHandTrackingEnabled(value)

使用手部跟踪设备,而不是虚拟现实控制器。

参数:value (bool) - 如果为 True,则使用手部跟踪设备

vrImmersiveInteractionService.setHandTrackingGestureEnabled(gesture, leftHand, enable)

设置在手部跟踪处于活动状态时 VRED 是否应检测手势。

参数:
  • gesture (vrHandTypes.HandTrackingGesture) - 要启用或禁用的手势
  • leftHand (bool) - True 表示左手的手势,False 表示右手的手势
  • enable (bool) - True 将启用手势,False 将禁用手势

vrImmersiveInteractionService.setHandTrackingOffset(offset)

HMD 上的跟踪设备固定点。

参数:offset (QMatrix4x4) - 描述从 HMD 到跟踪器的变换的矩阵

vrImmersiveInteractionService.setHandTrackingType(type)

设置应使用的手部跟踪设备类型。

参数:type (vrHandTypes.HandTrackingType) - 要使用的跟踪设备

vrImmersiveInteractionService.setInteractionActive(name, active)

激活或取消激活指定的交互工具。内置交互名为“传送”和“指针”。

参数:
  • name (string) - 交互标识符
  • active (bool) - 为 True 时激活,为 False 时取消激活。

vrImmersiveInteractionService.setMarkerTrackingType(markerIds, trackingType)

另请参见:vrdMarker.setTrackingType。

参数:
  • markerIds (List[integer]) - 将为其设置跟踪类型的标记 ID
  • trackingType (vrXRealityTypes.MarkerTrackingTypes) - 用于标记的跟踪类型。对于移动的标记,使用预测性值;对于保留在原位的标记,使用静态值。

vrImmersiveInteractionService.setMinMarkerConfidence(confidence)

设置最低标记置信度。当检测到置信度更低的标记时,将忽略它们。如果更新的数据的置信度更低,则不会更新系统已知的标记。

参数:confidence (float) - 最低置信度

vrImmersiveInteractionService.setPointerRayScaleRange(value)

设置指针光线的最小和最大比例值。值 1.0 等于 100% 缩放。

参数:value (QVector2D) - 比例范围 [min, max] 浮点值。

vrImmersiveInteractionService.setPointerScalingDistance(value)

设置指针缩放为 100% 的距离。

参数:value (float) - 以场景单位表示的缩放距离

vrImmersiveInteractionService.setPointerSphereScaleRange(value)

设置指针球体的最小和最大比例值。值 1.0 等于 100% 缩放。

参数:value (QVector2D) - 比例范围 [min, max] 浮点值。

vrImmersiveInteractionService.setPreferredControllerVisualizeMode(mode)

切换手的默认可视化样式。

参数:mode (vrVRInputDeviceTypes.VisualizationMode) - 启用手或控制器

vrImmersiveInteractionService.setPreferredTooltipsMode(show)

切换是否在会话开始时显示工具提示。

参数:show (bool) - 显示工具提示。

vrImmersiveInteractionService.setRelativeTeleportOrientation(isRelative)

设置从手腕的绝对旋转还是相对旋转获取方向角度。

参数:isRelative (bool) - 指示是否应使用相对旋转

vrImmersiveInteractionService.setShowTrackedHandsInMR(showHands)

设置 VRED 是否应在混合现实模式下显示跟踪的手部可视化。

参数:showHands (bool) - 如果应显示手,则为 True,否则为 False

vrImmersiveInteractionService.setTeleportAvailability(modes)

设置传送在哪些渲染模式下可用。

参数:modes (List[vrXRealityTypes.XRRenderMode]) - 默认情况下激活传送的模式。

vrImmersiveInteractionService.setTeleportGroundHeight(height)

设置“在地平面上”传送模式的地平面的高度。

参数:height (float) - 以场景单位表示的高度

vrImmersiveInteractionService.setTeleportGroundMode(mode)

设置在场景几何体上传送还是仅在虚拟地平面上传送。

参数:mode (vrImmersiveInteractionTypes.TeleportGroundMode) - 地面模式

vrImmersiveInteractionService.setTeleportRange(range)

设置最大传送距离。

参数:range (float) - 以场景单位表示的最大距离

vrImmersiveInteractionService.setUseBoundingBoxCollisionObjects(useBoundingBox)

为自动创建的碰撞对象启用边界框碰撞对象。

这对性能很有用,因为边界框碰撞对象的计算速度比默认凸面外壳线碰撞对象快,但准确性较低。

参数:useBoundingBox (bool) - True 表示启用边界框碰撞对象,False 表示使用凸面外壳线碰撞对象

vrImmersiveInteractionService.setViewpointMode(adjustHeight, adjustOrientation=True, adjustPosition=True)

更改视点选择的默认行为。实际摄影机位置是视点的变换加上 HMD 的变换。如果启用了调整,则会以某种方式修改摄影机位置,使生成的摄影机加上 HMD 位置与视点位置、高度或方向完全匹配。

参数:
  • adjustHeight (bool) - 如果为 True,则用户将移动到视点高度。
  • adjustOrientation (bool) - 如果为 True,则用户将定向到视点方向。
  • adjustPosition (bool) - 如果为 True,则用户将移动到视点位置。

vrImmersiveInteractionService.showControllerMessage(data, rightHand)

根据提供的数据显示控制器消息。

参数:
  • data (vrdDeviceMessageData) - 消息数据。
  • rightHand (bool) - 在右手或左手上显示它。
返回值:

消息的 vrdNode

返回值类型:

vrdNode

信号

vrImmersiveInteractionService.automaticCollisionObjectCreationChanged(automatic)

发出自动碰撞对象创建首选项已更改的通知。

参数:automatic (bool) - 新的首选项

vrImmersiveInteractionService.controllerVisualizationModeChanged(mode)

发出手可视化样式已更改的通知。

参数:mode (vrVRInputDeviceTypes.VisualizationMode) - 新的可视化样式

vrImmersiveInteractionService.hmdStatusChanged(active)

打开或关闭 HMD(虚拟现实)显示模式时触发此信号。

参数:active (bool) - 如果已打开 HMD 模式,则为 True

vrImmersiveInteractionService.markersDetected(markers)

检测到置信度等于或高于最低标记置信度的新标记时触发此信号。

参数:markers (List[vrdMarker]) - 检测到的标记

vrImmersiveInteractionService.markersUpdated(markers)

检测到置信度等于或高于最低标记置信度的新标记时触发此信号。

参数:markers (List[vrdMarker]) - 检测到的标记

vrImmersiveInteractionService.showTooltipsOnStartChanged(show)

发出在启动时显示工具提示已更改的通知。

参数:show (bool) - 必须显示工具提示

vrImmersiveInteractionService.teleportGroundModeChanged(mode)

发出传送地面模式已更改的通知。

参数:mode (vrImmersiveInteractionTypes.TeleportGroundMode) - 新的地面模式