Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Virtual Reality projects
Godot VR Breakout
Commits
e04c00b5
Commit
e04c00b5
authored
Apr 13, 2022
by
Ruben Rodriguez
Browse files
Added cyclotorsion correction (visor rotation)
parent
e9b98ba1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Visor.tscn
View file @
e04c00b5
...
...
@@ -19,6 +19,7 @@ var brightness = 0.0 #gets substracted from base value
var resolution = 3000
var x_rot = 0.0
var y_rot = 0.0
var z_rot = 0.0
var t = Transform.IDENTITY
var config = ConfigFile.new()
...
...
@@ -29,6 +30,7 @@ var offset = 0.1
func saveconf():
config.set_value(\"customeyes\", \"x_rot\", x_rot)
config.set_value(\"customeyes\", \"y_rot\", y_rot)
config.set_value(\"customeyes\", \"z_rot\", z_rot)
config.set_value(\"customeyes\", \"brightness\", brightness)
config.set_value(\"customeyes\", \"hpid\", hipd)
config.save(\"user://config.cfg\")
...
...
@@ -40,6 +42,7 @@ func _ready():
if err == OK:
x_rot = config.get_value(\"customeyes\", \"x_rot\", 0.0)
y_rot = config.get_value(\"customeyes\", \"y_rot\", 0.0)
z_rot = config.get_value(\"customeyes\", \"z_rot\", 0.0)
brightness = config.get_value(\"customeyes\", \"brightness\", 0.0)
hipd = config.get_value(\"customeyes\", \"hipd\", 0.0315)
...
...
@@ -66,12 +69,12 @@ func applybrightness(save=true):
func _input(event):
if event is InputEventKey:
if event.pressed and event.scancode == KEY_
Q
:
if event.pressed and event.scancode == KEY_
C
:
hipd -= 0.001
lcam.h_offset = -hipd
rcam.h_offset = hipd
saveconf()
if event.pressed and event.scancode == KEY_
E
:
if event.pressed and event.scancode == KEY_
V
:
hipd += 0.001
lcam.h_offset = -hipd
rcam.h_offset = hipd
...
...
@@ -98,6 +101,12 @@ func _input(event):
if event.pressed and event.scancode == KEY_A:
x_rot += 0.01
saveconf()
if event.pressed and event.scancode == KEY_Q:
z_rot -= 0.01
saveconf()
if event.pressed and event.scancode == KEY_E:
z_rot += 0.01
saveconf()
if event.pressed and event.scancode == KEY_ENTER:
ARVRServer.center_on_hmd(ARVRServer.RESET_FULL_ROTATION, false)
...
...
@@ -112,17 +121,20 @@ func _input(event):
#print(\"Lcam h-offset %s\" % lcam.h_offset)
#print(\"rcam h-offset %s\" % rcam.h_offset)
print(\"hipd %s\" % hipd)
print(\"y_rot %s\" % y_rot)
print(\"x_rot %s\" % x_rot)
print(\"y_rot %s\" % y_rot)
print(\"z_rot %s\" % x_rot)
print(\"brightness %s\" % brightness)
func _process(delta):
t = hmd.get_global_transform()
lcam.set_global_transform(t * Transform.IDENTITY \\
.rotated(Vector3.UP, -x_rot + offset) \\
.rotated(Vector3.FORWARD, -z_rot) \\
.rotated(Vector3.LEFT, y_rot))
rcam.set_global_transform(t * Transform.IDENTITY \\
.rotated(Vector3.UP, x_rot - offset) \\
.rotated(Vector3.FORWARD, z_rot) \\
.rotated(Vector3.RIGHT, y_rot))
"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment