From a0967ebe815cd229b69fb9578f2288b95b2ddb28 Mon Sep 17 00:00:00 2001 From: Anson Bridges Date: Sun, 4 Sep 2022 14:57:56 -0700 Subject: networked machine project. added broken airplane from previous project --- scripts/cameras/plane_armcam.gd | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 scripts/cameras/plane_armcam.gd (limited to 'scripts/cameras/plane_armcam.gd') diff --git a/scripts/cameras/plane_armcam.gd b/scripts/cameras/plane_armcam.gd new file mode 100644 index 0000000..edb0284 --- /dev/null +++ b/scripts/cameras/plane_armcam.gd @@ -0,0 +1,26 @@ +extends SpringArm + + + +# Called when the node enters the scene tree for the first time. +func _ready(): + Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE) + $ClippedCamera.add_exception(get_parent()) + add_excluded_object(get_parent().get_rid()) + + +#func _process(delta): + + +func _input(event): + if $ClippedCamera.current: + if Input.is_action_just_pressed("menu"): #toggle mouse capture on esc + if Input.get_mouse_mode() == Input.MOUSE_MODE_VISIBLE: + Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) + else: + Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE) + + if Input.get_mouse_mode() == Input.MOUSE_MODE_CAPTURED: + if event is InputEventMouseMotion: + rotation_degrees.x = clamp(rotation_degrees.x-event.relative.y*0.1,-70,70) + rotation_degrees.y -= event.relative.x*0.1 -- cgit v1.2.3