Rigidbody3D functional prototype
This commit is contained in:
16
core/scripts/GameManager.gd
Normal file
16
core/scripts/GameManager.gd
Normal file
@@ -0,0 +1,16 @@
|
||||
extends Node3D
|
||||
|
||||
|
||||
@export var camera_array: Array[Camera3D] = []
|
||||
@export var current_camera: int = 0
|
||||
|
||||
|
||||
func _process(delta):
|
||||
if camera_array.size() != 0 and Input.is_action_just_released("change_camera_view"):
|
||||
current_camera += 1
|
||||
if current_camera <= camera_array.size() - 1:
|
||||
camera_array[current_camera].make_current()
|
||||
else:
|
||||
current_camera = 0
|
||||
camera_array[current_camera].make_current()
|
||||
print(current_camera)
|
||||
5
core/scripts/camera_3d.gd
Normal file
5
core/scripts/camera_3d.gd
Normal file
@@ -0,0 +1,5 @@
|
||||
extends Camera3D
|
||||
|
||||
|
||||
func _ready():
|
||||
GameManager.camera_array.append(self)
|
||||
20
core/scripts/los_view.gd
Normal file
20
core/scripts/los_view.gd
Normal file
@@ -0,0 +1,20 @@
|
||||
extends Node3D
|
||||
|
||||
@export var zoom_curve: Curve
|
||||
|
||||
var child_camera: Camera3D
|
||||
var drone: RigidBody3D
|
||||
var dist_to_drone: float = 0.0
|
||||
|
||||
func _ready():
|
||||
child_camera = get_child(0)
|
||||
drone = get_parent().get_node("Drone")
|
||||
|
||||
|
||||
func _physics_process(delta):
|
||||
look_at(drone.global_position)
|
||||
|
||||
dist_to_drone = global_position.distance_to(drone.global_position)
|
||||
|
||||
child_camera.fov = zoom_curve.sample((dist_to_drone-1)/89)
|
||||
|
||||
Reference in New Issue
Block a user