Commit e04c00b5 authored by Ruben Rodriguez's avatar Ruben Rodriguez
Browse files

Added cyclotorsion correction (visor rotation)

parent e9b98ba1
......@@ -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))
"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment