Added automatic procedural level of detail to planets
This commit is contained in:
20
godot/Scripts/Player/Camera3D.gd
Normal file
20
godot/Scripts/Player/Camera3D.gd
Normal file
@ -0,0 +1,20 @@
|
||||
extends Camera3D
|
||||
|
||||
@export var velocity: Vector3
|
||||
@export var acceleration: Vector3
|
||||
var g : float = 0.01
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
global_position = Vector3(0,0,-150)
|
||||
acceleration = -global_position.normalized()
|
||||
velocity = Vector3(0.5, 0.5, 0)
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta):
|
||||
acceleration = -global_position.normalized() * g
|
||||
velocity += acceleration
|
||||
global_translate(velocity)
|
||||
Global.camera_position = global_position
|
||||
look_at(Vector3(0,0,0))
|
Reference in New Issue
Block a user