Skip to content

Commit

Permalink
simulation now works without checking if a vr interface is available
Browse files Browse the repository at this point in the history
  • Loading branch information
Cafezinhu committed Feb 4, 2023
1 parent 3953e86 commit 8bbb5a2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
15 changes: 8 additions & 7 deletions addons/vr-simulator/SimulatedController.gd
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@ func _ready():
for _i in range(16):
buttons.append(false)

func get_controller_name():
return "Simulated controller"

func get_is_active():
return true

func get_joystick_axis(axis):
var base_axis = .get_joystick_axis(axis)
if base_axis != 0:
return base_axis

if axis == 0:
return x_axis
elif axis == 1:
Expand All @@ -28,11 +29,11 @@ func get_joystick_axis(axis):
else:
return 0

func get_joystick_id():
return 0

func is_button_pressed(button: int):
return buttons[button]
var is_base_pressed = .is_button_pressed(button)
if not is_base_pressed:
return buttons[button]
return is_base_pressed

func press_button(button: int):
buttons[button] = true
Expand Down
5 changes: 1 addition & 4 deletions addons/vr-simulator/VRSimulator.gd
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
extends Node

export var enabled: bool
export var xr_interface = "OpenXR"
export var device_x_sensitivity: float = 1
export var device_y_sensitivity: float = 1
export var scroll_sensitivity: float = 1
Expand Down Expand Up @@ -32,9 +31,7 @@ var key_map = {
}

func _enter_tree():
var interface = ARVRServer.find_interface(xr_interface)
if not enabled or (interface and interface.initialize()):
enabled = false
if not enabled:
return

Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
Expand Down

0 comments on commit 8bbb5a2

Please sign in to comment.