Created
February 3, 2026 04:17
-
-
Save zvodd/3550a43d130442c9fc76dc4e7857c9a2 to your computer and use it in GitHub Desktop.
Simple FryFlee Cam for Godot 3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| extends Camera | |
| var yaw_pitch = Vector2(0,0) | |
| func _process(delta): | |
| var speedmod = 35.0 if Input.is_action_pressed("move_sprint") else 18.0 | |
| self.translate(Vector3( | |
| Input.get_axis("move_left","move_right"), | |
| Input.get_axis("equipCamera", "Interact"), | |
| Input.get_axis("move_forward","move_backward") | |
| ) * delta * speedmod ) | |
| self.transform.basis = Basis( | |
| Quat(Vector3(0.0, 1.0, 0.0), -yaw_pitch.x) | |
| * | |
| Quat(Vector3(1.0, 0.0, 0.0), -yaw_pitch.y) | |
| ) | |
| func _input(event): | |
| if event is InputEventMouseButton: | |
| var ev = event as InputEventMouseButton | |
| if ev.pressed: | |
| Input.set_mouse_mode( | |
| Input.MOUSE_MODE_CAPTURED | |
| if Input.get_mouse_mode() != Input.MOUSE_MODE_CAPTURED #^ | |
| else Input.MOUSE_MODE_VISIBLE | |
| ) | |
| elif event is InputEventMouseMotion and Input.get_mouse_mode() == Input.MOUSE_MODE_CAPTURED: | |
| var ev = event as InputEventMouseMotion | |
| yaw_pitch += ev.relative * 1.0 / TAU * 0.01#* ev.speed |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment