asset vibe
This commit is contained in:
@@ -25,6 +25,11 @@ func _physics_process(delta: float) -> void:
|
||||
if direction:
|
||||
player.velocity.x = direction.x * PlayerData.speed
|
||||
player.velocity.z = direction.z * PlayerData.speed
|
||||
var world_yaw: float = atan2(-direction.x, -direction.z)
|
||||
var local_yaw: float = world_yaw - player.rotation.y
|
||||
var mesh: Node3D = player.get_node_or_null("Mesh") as Node3D
|
||||
if mesh:
|
||||
mesh.rotation.y = lerp_angle(mesh.rotation.y, local_yaw, 10.0 * delta)
|
||||
else:
|
||||
player.velocity.x = move_toward(player.velocity.x, 0, PlayerData.speed)
|
||||
player.velocity.z = move_toward(player.velocity.z, 0, PlayerData.speed)
|
||||
|
||||
Reference in New Issue
Block a user