在 Godot 中获取 VR 游戏空间和跟踪区域边界

Getting VR playspace in Godot and tracked area bounds

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

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

使用 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