godot-platform-vr

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Platform: VR

平台:VR

90+ FPS, comfort-first design, and motion control accuracy define VR development.
90+ FPS、舒适度优先的设计以及精准的运动控制是VR开发的核心要求。

Available Scripts

可用脚本

vr_physics_hand.gd

vr_physics_hand.gd

Expert physics-based hand controller with grab detection and velocity throwing.
基于物理引擎的专业手部控制器,支持抓取检测和带速度的投掷功能。

NEVER Do in VR Development

VR开发中的绝对禁忌

  • NEVER drop below 90 FPS — 72 FPS in VR = instant nausea. MUST maintain 90 FPS minimum (Quest 2/3), 120 FPS preferred. Use Debug → Profiler aggressively.
  • NEVER use smooth rotation without vignetting — Smooth camera rotation = vestibular mismatch = motion sickness. Provide snap turning (30°/45°) OR vignette during rotation.
  • NEVER place UI too close or too far — UI at 0.5m = eye strain, at 10m = unreadable. Optimal distance: 1-3m from player.
  • NEVER ignore motion-to-photon latency — >20ms latency = visible lag in hand tracking = breaks immersion. Minimize physics steps + rendering delay.
  • NEVER skip teleport locomotion option — Not everyone tolerates smooth locomotion. MUST offer teleport as alternative for accessibility.
  • NEVER forget physical boundaries — Player punches wall IRL = lawsuit. Use
    XRServer.get_reference_frame()
    to respect guardian/chaperone bounds.
  • NEVER use standard 3D audio — Stereo audio in VR = disorienting. Use spatial audio (AudioStreamPlayer3D) for positional sound cues.

gdscript
undefined
  • 绝对不能低于90 FPS — VR场景下72 FPS会立即引发晕动症。必须维持最低90 FPS(Quest 2/3),优先达到120 FPS。要积极使用Debug → Profiler工具进行性能分析。
  • 绝对不能在无渐晕效果的情况下使用平滑旋转 — 相机平滑旋转会导致前庭系统不匹配,进而引发晕动症。应提供快速转身(30°/45°)功能,或在旋转时添加渐晕效果。
  • 绝对不能将UI放置过近或过远 — UI在0.5m处会导致眼疲劳,在10m处则无法看清。最佳距离为距离玩家1-3米。
  • 绝对不能忽视运动到光子的延迟 — 延迟超过20ms会导致手部追踪出现明显卡顿,破坏沉浸感。需尽量减少物理运算步骤和渲染延迟。
  • 绝对不能省略传送移动选项 — 并非所有人都能适应平滑移动方式。必须提供传送作为替代方案,以提升可访问性。
  • 绝对不能忽视物理边界 — 玩家在现实中撞到墙壁可能引发纠纷。请使用
    XRServer.get_reference_frame()
    来遵循守护边界/陪护系统的限制。
  • 绝对不能使用标准3D音频 — VR场景下的立体声会让人迷失方向。请使用空间音频(AudioStreamPlayer3D)来实现位置化音效提示。

gdscript
undefined

Enable XR

Enable XR

func _ready() -> void: var xr_interface := XRServer.find_interface("OpenXR") if xr_interface and xr_interface.initialize(): get_viewport().use_xr = true
undefined
func _ready() -> void: var xr_interface := XRServer.find_interface("OpenXR") if xr_interface and xr_interface.initialize(): get_viewport().use_xr = true
undefined

Comfort Settings

舒适度设置

  • Vignetting during movement
  • Snap turning (30°/45° increments)
  • Teleport locomotion option
  • Seated mode support
  • 渐晕效果:在移动时启用
  • 快速转身(30°/45°增量)
  • 传送移动选项
  • 坐姿模式支持

Motion Controls

运动控制

gdscript
undefined
gdscript
undefined

XRController3D for hands

XRController3D for hands

@onready var left_hand := $XROrigin3D/LeftController @onready var right_hand := $XROrigin3D/RightController
func _process(delta: float) -> void: if left_hand.is_button_pressed("trigger"): grab_with_left()
undefined
@onready var left_hand := $XROrigin3D/LeftController @onready var right_hand := $XROrigin3D/RightController
func _process(delta: float) -> void: if left_hand.is_button_pressed("trigger"): grab_with_left()
undefined

Performance

性能要求

  • 90 FPS minimum - Critical for comfort
  • Low latency - < 20ms motion-to-photon
  • Foveated rendering if supported
  • 最低90 FPS - 对舒适度至关重要
  • 低延迟 - 运动到光子延迟<20ms
  • 注视点渲染(如果设备支持)

Best Practices

最佳实践

  1. Comfort First - Prevent motion sickness
  2. High FPS - 90+ required
  3. Physical Space - Respect boundaries
  4. UI Distance - 1-3m from player
  1. 舒适度优先 - 预防晕动症
  2. 高帧率 - 必须达到90+ FPS
  3. 物理空间 - 遵循现实边界
  4. UI距离 - 距离玩家1-3米

Reference

参考资料

  • Related:
    godot-camera-systems
    ,
    godot-input-handling
  • 相关内容:
    godot-camera-systems
    godot-input-handling

Related

相关技能

  • Master Skill: godot-master
  • 核心技能:godot-master