working on player character
This commit is contained in:
16
Scripts/player_camera.gd
Normal file
16
Scripts/player_camera.gd
Normal file
@@ -0,0 +1,16 @@
|
||||
extends Camera3D
|
||||
class_name PlayerCamera
|
||||
|
||||
@export var player : Player
|
||||
|
||||
const CAM_MOVE_SPEED = 5
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
follow_player(delta)
|
||||
|
||||
|
||||
func follow_player(delta):
|
||||
var player_pos = player.global_position
|
||||
|
||||
global_position.x = lerp(global_position.x,player_pos.x,delta * CAM_MOVE_SPEED)
|
||||
global_position.z = lerp(global_position.z,player_pos.z,delta * CAM_MOVE_SPEED)
|
||||
Reference in New Issue
Block a user