forked from GodotVR/TiltFiveGodot4
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'add_friendly_name' into ahead_of_godotvr
- Loading branch information
Showing
19 changed files
with
133 additions
and
57 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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using Godot; | ||
using System; | ||
|
||
public partial class ExampleRig : T5XRRig | ||
{ | ||
Node3D pivot; | ||
|
||
public override void _Ready() | ||
{ | ||
pivot = GetNode<Node3D>("Origin/Pivot"); | ||
var label = GetNode<Label3D>("Origin/Pivot/GlassesName"); | ||
|
||
var timer = new Timer(); | ||
timer.Autostart = true; | ||
timer.WaitTime = 1.0; | ||
AddChild(timer); | ||
timer.Timeout += () => label.Text = GlassesName; | ||
} | ||
|
||
// Called every frame. 'delta' is the elapsed time since the previous frame. | ||
public override void _Process(double delta) | ||
{ | ||
var pos = Camera.GlobalPosition; | ||
if(pivot.GlobalPosition.DistanceTo(pos) < 0.01) return; | ||
pivot.LookAt(new Vector3(pos.X, pivot.GlobalPosition.Y, pos.Z), Vector3.Up, true); | ||
} | ||
} |
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
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
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
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
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
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,7 +1,9 @@ | ||
extends Node3D | ||
|
||
func _on_t5_manager_glasses_scene_was_added(glasses): | ||
print("Scene ", glasses.name, " added") | ||
|
||
func _on_t5_manager_glasses_scene_will_be_removed(glasses): | ||
print("Scene ", glasses.name, " removed") | ||
func _on_t5_manager_xr_rig_was_added(xr_rig): | ||
print("Scene for glasses ", xr_rig.get_glasses_id(), " added") | ||
|
||
|
||
func _on_t5_manager_xr_rig_will_be_removed(xr_rig): | ||
print("Scene for glasses ", xr_rig.get_glasses_id(), " removed") |
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
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
extends T5XRRig | ||
|
||
|
||
func _ready(): | ||
var timer = Timer.new() | ||
timer.autostart = true | ||
timer.wait_time = 1 | ||
add_child(timer) | ||
timer.timeout.connect(func(): | ||
$Origin/Pivot/GlassesName.text = get_glasses_name() | ||
) | ||
|
||
func _process(delta): | ||
var pos : Vector3 = $Origin/Camera.global_position | ||
if pos.distance_to($Origin/Pivot.global_position) < 0.001: return | ||
$Origin/Pivot.look_at(Vector3(pos.x, $Origin/Pivot.global_position.y, pos.z), Vector3.UP, true) |
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
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