mirror of
https://github.com/Relintai/broken_seals.git
synced 2024-11-10 08:42:11 +01:00
Now the camera gets instantiated when needed automatically by the body script.
This commit is contained in:
parent
1d7a428987
commit
2382f9d3c1
14
game/data/camera/CameraPivot.tscn
Normal file
14
game/data/camera/CameraPivot.tscn
Normal file
@ -0,0 +1,14 @@
|
||||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://player/CameraPivot.gd" type="Script" id=1]
|
||||
|
||||
[node name="CameraPivot" type="Spatial"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.44092, 0 )
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="Camera" type="Camera" parent="."]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 6.822 )
|
||||
current = true
|
||||
fov = 60.0
|
||||
size = 28.0
|
||||
far = 1000.0
|
@ -23,8 +23,6 @@
|
||||
|
||||
extends KinematicBody
|
||||
|
||||
|
||||
|
||||
export(float) var max_visible_distance : float = 120 setget set_max_visible_distance
|
||||
var max_visible_distance_squared : float = max_visible_distance * max_visible_distance
|
||||
|
||||
@ -573,6 +571,19 @@ func on_c_controlled_changed(val):
|
||||
# set_physics_process(val)
|
||||
set_process_input(val)
|
||||
set_process_unhandled_input(val)
|
||||
|
||||
if val:
|
||||
var cam_scene : PackedScene = ResourceLoader.load("res://data/camera/CameraPivot.tscn")
|
||||
camera_pivot = cam_scene.instance() as Spatial
|
||||
add_child(camera_pivot)
|
||||
|
||||
camera = camera_pivot.get_node("Camera") as Camera
|
||||
else:
|
||||
if camera_pivot:
|
||||
camera_pivot.queue_free()
|
||||
camera_pivot = null
|
||||
camera = null
|
||||
|
||||
|
||||
func on_sdied(entity):
|
||||
if dead:
|
||||
|
@ -39,5 +39,3 @@ transform = Transform( -1, 0, -3.25841e-07, 0, 1, 0, 3.25841e-07, 0, -1, 0, 0, 0
|
||||
[node name="Model" type="Spatial" parent="Body/Rotation_Helper"]
|
||||
|
||||
[node name="character" parent="Body/Rotation_Helper/Model" instance=ExtResource( 1 )]
|
||||
refresh_in_editor = false
|
||||
use_lod = true
|
||||
|
@ -35,8 +35,6 @@ transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.960532, 0 )
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.875205, 0 )
|
||||
|
||||
[node name="character" parent="Body/Rotation_Helper/Model" instance=ExtResource( 2 )]
|
||||
refresh_in_editor = false
|
||||
use_lod = true
|
||||
|
||||
[node name="NamePlate" parent="." instance=ExtResource( 3 )]
|
||||
max_distance = 50.0
|
||||
|
@ -1,9 +1,8 @@
|
||||
[gd_scene load_steps=8 format=2]
|
||||
[gd_scene load_steps=7 format=2]
|
||||
|
||||
[ext_resource path="res://data/models/armature_model_orig_v2.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://player/Player.gd" type="Script" id=2]
|
||||
[ext_resource path="res://ui/player_ui/player_ui.tscn" type="PackedScene" id=3]
|
||||
[ext_resource path="res://player/CameraPivot.gd" type="Script" id=4]
|
||||
[ext_resource path="res://player/Body.gd" type="Script" id=5]
|
||||
|
||||
[sub_resource type="CapsuleShape" id=1]
|
||||
@ -31,25 +30,12 @@ shape = SubResource( 1 )
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.1, 0 )
|
||||
shape = SubResource( 2 )
|
||||
|
||||
[node name="CameraPivot" type="Spatial" parent="Body"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.44092, 0 )
|
||||
script = ExtResource( 4 )
|
||||
|
||||
[node name="Camera" type="Camera" parent="Body/CameraPivot"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 6.822 )
|
||||
current = true
|
||||
fov = 60.0
|
||||
size = 28.0
|
||||
far = 1000.0
|
||||
|
||||
[node name="Rotation_Helper" type="Spatial" parent="Body"]
|
||||
transform = Transform( -1, 0, -3.25841e-07, 0, 1, 0, 3.25841e-07, 0, -1, 0, 0, 0 )
|
||||
|
||||
[node name="Model" type="Spatial" parent="Body/Rotation_Helper"]
|
||||
|
||||
[node name="character" parent="Body/Rotation_Helper/Model" instance=ExtResource( 1 )]
|
||||
refresh_in_editor = false
|
||||
use_lod = true
|
||||
|
||||
[node name="GUILayer" parent="." instance=ExtResource( 3 )]
|
||||
[connection signal="onc_open_loot_winow_request" from="." to="GUILayer" method="_on_Player_onc_open_loot_winow_request"]
|
||||
|
Loading…
Reference in New Issue
Block a user