This commit is contained in:
mathias committed 2020-02-02 12:52:18 +01:00
commit 9defb29c04
29 files changed
+273 -43

No files matched your search

+2 -4
View File
@@ -2,11 +2,9 @@
[ext_resource path="res://Ingame/Level/Torch.tscn" type="PackedScene" id=1]
[ext_resource path="res://Ingame/Level/Ground.tscn" type="PackedScene" id=2]
[ext_resource path="res://default_env.tres" type="Environment" id=3]
[ext_resource path="res://Ingame/Level/Fence.tscn" type="PackedScene" id=5]
[sub_resource type="Environment" id=1]
ambient_light_color = Color( 0.203922, 0.231373, 0.329412, 1 )
[sub_resource type="Curve3D" id=2]
_data = {
"points": PoolVector3Array( -6.18582, 0, 7.84923, 6.18582, 0, -7.84923, -49.9513, 0, -34.3585, -4.51454, 0, 0.679321, 4.51454, 0, -0.679321, -15.3927, 0, -53.766, -21.9094, 0, -9.41343, 21.9094, 0, 9.41343, 23.1226, 0, -50.5878, -3.51591, 0, -8.89224, 3.51591, 0, 8.89224, 48.9412, 0, -26.3448, -0.144619, 0, -5.61391, 0.144619, 0, 5.61391, 60.7732, 0, 13.6973, 4.99704, -4.57764e-05, -11.0807, -4.99704, 4.57764e-05, 11.0807, 54.4575, 0, 49.3261, 10.0432, 0, -5.64291, -10.0432, 0, 5.64291, 32.3244, 0, 71.386, 10.2301, 0, -1.21242, -10.2301, 0, 1.21242, 2.64864, -1.52588e-05, 80.1473, 8.65666, 0, 3.83833, -8.65666, 0, -3.83833, -24.225, 0, 77.5418, 6.10191, 0, 6.62698, -6.10191, 0, -6.62698, -47.3545, 0, 62.2559, 2.38824, 0, 9.77866, -2.38824, 0, -9.77866, -62.2404, 0, 29.8337, -1.39743, 0, 9.2999, 1.39743, 0, -9.2999, -65.2092, 0, -9.54412, 0, 0, 0, 0, 0, 0, -49.9513, 0, -34.3585 ),
@@ -34,7 +32,7 @@ transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 52.7943, 0, 76.6803 )
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -0.293457, 0, 5.53332 )
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
environment = SubResource( 1 )
environment = ExtResource( 3 )
[node name="ground" parent="." instance=ExtResource( 2 )]
+14 -2
View File
@@ -2,6 +2,18 @@ extends Spatial
onready var camera = get_node("Camera")
const DISTANCE_MOD = 0.2
const FOV_MOD = 0.2
var _look_at_vec = Vector3(0, 0, -1)
var _x_axis = Vector3(1, 0, 0)
func _ready():
var cam_rot = camera.rotation_degrees
_look_at_vec = _look_at_vec.rotated(Vector3(0, 1, 0), cam_rot.y * PI/180)
_x_axis = _x_axis.rotated(Vector3(0, 1, 0), cam_rot.y * PI/180)
_look_at_vec = _look_at_vec.rotated(_x_axis, cam_rot.x * PI/180)
func _process(delta: float) -> void:
var player1 = get_parent().get_child(3)
@@ -12,6 +24,6 @@ func _process(delta: float) -> void:
var center = player2.transform.origin + (player1.transform.origin - player2.transform.origin) / 2.0
var distance = (player1.transform.origin - player2.transform.origin).length()
camera.fov = distance + 50.0
camera.fov = distance * FOV_MOD + 60.0
transform.origin = center
transform.origin = center - _look_at_vec * distance * DISTANCE_MOD