a bit of restructuring, renaming, and c sharp setup
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
extends Node3D
|
||||
|
||||
@export var canPitch: bool = false
|
||||
@export var canYaw: bool = false
|
||||
@export var rotateSpeed: float = 0.003
|
||||
@onready var sub_pivot: Node3D = $SubPivot
|
||||
|
||||
func _ready() -> void:
|
||||
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
|
||||
|
||||
func _input(event):
|
||||
if event.is_action_pressed("click"):
|
||||
if Input.mouse_mode == Input.MOUSE_MODE_VISIBLE:
|
||||
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
|
||||
|
||||
if event.is_action_pressed("ui_cancel"):
|
||||
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
|
||||
|
||||
if event is InputEventMouseMotion:
|
||||
if Input.mouse_mode != Input.MOUSE_MODE_CAPTURED: return
|
||||
if canYaw: sub_pivot.rotate_x(event.relative.y * -rotateSpeed)
|
||||
if canPitch: rotate_y(event.relative.x * -rotateSpeed)
|
||||
Reference in New Issue
Block a user