-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
formatting cleanup for godot standards
- Loading branch information
1 parent
ab82688
commit a913825
Showing
7 changed files
with
94 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,19 @@ | ||
# Godot 4+ specific ignores | ||
.godot/ | ||
|
||
# Godot-specific ignores | ||
.import/ | ||
export.cfg | ||
export_presets.cfg | ||
|
||
# Imported translations (automatically generated from CSV files) | ||
*.translation | ||
|
||
# Mono-specific ignores | ||
.mono/ | ||
data_*/ | ||
mono_crash.*.json | ||
|
||
# builds | ||
[Bb]uild/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,21 @@ | ||
extends Spatial | ||
|
||
## | ||
## XR Floating HUD | ||
## | ||
## The script ensures the HUD stays relative to the XR player's height. | ||
## | ||
|
||
var _offset := Vector3.ZERO | ||
|
||
|
||
func _ready(): | ||
_offset = global_translation - XrOrFlatMode._get_xr_origin().global_translation | ||
_offset = global_translation - XrOrFlatMode.get_xr_origin().global_translation | ||
|
||
|
||
func _process(delta): | ||
func _process(_delta): | ||
# Keep the original X/Z offset | ||
global_translation = XrOrFlatMode._get_xr_origin().global_translation + _offset | ||
global_translation = XrOrFlatMode.get_xr_origin().global_translation + _offset | ||
|
||
# Apply the player height Y | ||
translation.y = XrOrFlatMode.xr_player_height() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,30 @@ | ||
class_name CorrectedARVRCamera | ||
extends ARVRCamera | ||
|
||
|
||
|
||
## | ||
## XR Stage/Camera Rotation Mis-Match Correction Script | ||
## | ||
## @desc: | ||
## This whole script is a workaround for sometimes the XR stage not | ||
## being aligned with the initial camera rotation | ||
## This whole script is a workaround for sometimes the XR stage not | ||
## being aligned with the initial camera rotation | ||
## | ||
|
||
|
||
var _last_rotation := Vector3.ZERO | ||
|
||
var _correction_applied := false | ||
|
||
|
||
func _process(delta): | ||
func _process(_delta): | ||
if _last_rotation != Vector3.ZERO and not _correction_applied: | ||
var rotationY = global_rotation.y | ||
var rotation_y = global_rotation.y | ||
|
||
# Rotate towards where the Origin node is pointing | ||
get_parent().global_rotation.y -= rotationY | ||
get_parent().global_rotation.y -= rotation_y | ||
|
||
# Inform the Singleton of the offset applied | ||
XrOrFlatMode.XrRotationYCorrection = rotationY | ||
XrOrFlatMode.xr_y_rotation_correction = rotation_y | ||
|
||
# Never Run this code for the life of this XR Camera | ||
_correction_applied = true | ||
set_process(false) | ||
|
||
_last_rotation = global_rotation | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.