mirror of
https://github.com/bvanroll/pogo.git
synced 2025-08-29 12:02:47 +00:00
mmm
This commit is contained in:
19
player_cam.gd
Normal file
19
player_cam.gd
Normal file
@@ -0,0 +1,19 @@
|
||||
extends Camera3D
|
||||
@onready
|
||||
var player = $"../player"
|
||||
|
||||
const cam_speed = 20.0
|
||||
const cam_distance = 2.0
|
||||
const player_height = 2.0
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta):
|
||||
position.y = move_toward(position.y, player.position.y + cam_distance + player_height/2., cam_speed * delta)
|
||||
position.z = move_toward(position.z, player.position.z + cam_distance, cam_speed*delta)
|
||||
position.x = move_toward(position.x, player.position.x, cam_speed* delta)
|
||||
look_at(player.position + Vector3(0., player_height, 0.))
|
||||
pass
|
Reference in New Issue
Block a user