-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathMain.gd
21 lines (18 loc) · 987 Bytes
/
Main.gd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
extends Spatial
func _process(delta):
# Test for escape to close application, space to reset our reference frame
if (Input.is_key_pressed(KEY_ESCAPE)):
get_tree().quit()
elif (Input.is_key_pressed(KEY_SPACE)):
# Calling center_on_hmd will cause the ARVRServer to adjust all tracking data so the player is centered on the origin point looking forward
ARVRServer.center_on_hmd(true, true)
# We minipulate our origin point to move around. Note that with roomscale tracking a little more then this is needed
# because we'll rotate around our origin point, not around our player. But that is a subject for another day.
if (Input.is_key_pressed(KEY_LEFT)):
$ARVROrigin.rotation.y += delta
elif (Input.is_key_pressed(KEY_RIGHT)):
$ARVROrigin.rotation.y -= delta
if (Input.is_key_pressed(KEY_UP)):
$ARVROrigin.translation -= $ARVROrigin.transform.basis.z * delta;
elif (Input.is_key_pressed(KEY_DOWN)):
$ARVROrigin.translation += $ARVROrigin.transform.basis.z * delta;