首页 > 解决方案 > 在 Godot 中获取 VR 游戏空间和跟踪区域边界

问题描述

使用 ARVROrigin,您可以获得虚拟世界中游戏空间的中心,但我想知道玩家必须使用的中心周围有多少空间。为此,我想知道游戏空间的尺寸和它的方向(假设它是一个矩形......对于 Quest 不确定),以及跟踪区域外部边界的某种表示。这样我就可以根据玩家在物理环境中的位置来调整游戏体验。

我正在考虑利用跟踪区域在空间中动态放置墙壁,以创建一个无限可探索的建筑,有点像看不见的外交。

标签: godot

解决方案


使用该GodotVR插件,您可以使用以下代码获取表示监护人边界的数组:

onready var ovrTrackingTransform = preload("res://addons/godot_ovrmobile/OvrTrackingTransform.gdns").new()
onready var ovrGuardianSystem = preload("res://addons/godot_ovrmobile/OvrGuardianSystem.gdns").new()

func _process(delta):
    print("GetTrackingSpace: " , ovrTrackingTransform.get_tracking_space())

    print("GetBoundaryVisible: ", ovrGuardianSystem.get_boundary_visible())
    print("GetBoundaryOrientedBoundingBox: ", ovrGuardianSystem.get_boundary_oriented_bounding_box())

取自https://github.com/GodotVR/godot_oculus_mobile


推荐阅读