Smoothen camera
This commit is contained in:
parent
6766c63abe
commit
3eb8b2a718
|
@ -1,6 +1,9 @@
|
|||
extends Node3D
|
||||
|
||||
const MOUSE_SENSITIVITY := .001
|
||||
const MOUSE_VISCOSITY := 0.5
|
||||
|
||||
var _goal_rotation_y := rotation.y
|
||||
|
||||
func get_input_direction() -> Vector2:
|
||||
var input := Input.get_vector("move_left", "move_right", "move_up", "move_down")
|
||||
|
@ -14,6 +17,9 @@ func get_input_direction() -> Vector2:
|
|||
func _process(_delta):
|
||||
get_parent().movement_dir = get_input_direction()
|
||||
%SpringArm3D.look_at(global_position)
|
||||
|
||||
var rot_y := lerp_angle(rotation.y, _goal_rotation_y, MOUSE_VISCOSITY)
|
||||
rotation.y = rot_y
|
||||
|
||||
func _ready():
|
||||
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
|
||||
|
@ -22,7 +28,7 @@ func handle_camera_movement(move: Vector2):
|
|||
if Input.mouse_mode != Input.MOUSE_MODE_CAPTURED:
|
||||
return
|
||||
move *= MOUSE_SENSITIVITY
|
||||
rotate_y(-move.x)
|
||||
_goal_rotation_y -= move.x
|
||||
|
||||
func _input(event):
|
||||
if event is InputEventMouseMotion:
|
||||
|
|
|
@ -8,6 +8,24 @@
|
|||
|
||||
config_version=5
|
||||
|
||||
[Fmod]
|
||||
|
||||
General/auto_initialize=true
|
||||
General/channel_count=1024
|
||||
General/is_live_update_enabled=true
|
||||
General/is_memory_tracking_enabled=false
|
||||
"Software Format/sample_rate"=48000
|
||||
"Software Format/speaker_mode"=3
|
||||
"Software Format/raw_speaker_count"=0
|
||||
General/default_listener_count=1
|
||||
General/banks_path="res://"
|
||||
General/should_load_by_name=false
|
||||
DSP/dsp_buffer_size=512
|
||||
DSP/dsp_buffer_count=4
|
||||
"3D Settings/doppler_scale"=1.0
|
||||
"3D Settings/distance_factor"=1.0
|
||||
"3D Settings/rolloff_scale"=1.0
|
||||
|
||||
[application]
|
||||
|
||||
config/name="Grounders"
|
||||
|
|
Loading…
Reference in New Issue