Improved animations

This commit is contained in:
Eduard Urbach 2024-02-05 10:36:26 +01:00
parent 885276de46
commit 1029a5ea27
Signed by: akyoto
GPG Key ID: C874F672B1AF20C0
4 changed files with 35 additions and 11 deletions

View File

@ -90,16 +90,20 @@ autostart = true
[node name="World" type="Node3D" parent="."] [node name="World" type="Node3D" parent="."]
[node name="Pivot" type="Node3D" parent="World"] [node name="Follow" type="Node3D" parent="World"]
[node name="Camera" type="Camera3D" parent="World/Pivot" node_paths=PackedStringArray("center")] [node name="Pivot" type="Node3D" parent="World/Follow"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 7, 15) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
[node name="Camera" type="Camera3D" parent="World/Follow/Pivot" node_paths=PackedStringArray("follow", "pivot")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 3.5, 7.5)
current = true current = true
fov = 30.0 fov = 30.0
size = 10.0 size = 10.0
far = 100.0 far = 1000.0
script = ExtResource("18_wogcj") script = ExtResource("18_wogcj")
center = NodePath("..") follow = NodePath("../..")
pivot = NodePath("..")
follow_speed = 5.0 follow_speed = 5.0
[node name="Sun" type="DirectionalLight3D" parent="World"] [node name="Sun" type="DirectionalLight3D" parent="World"]

View File

@ -1,17 +1,18 @@
extends Camera3D extends Camera3D
@export var center: Node3D @export var follow: Node3D
@export var pivot: Node3D
@export var follow_speed: float @export var follow_speed: float
func _ready(): func _ready():
Global.camera = self Global.camera = self
look_at(center.position) look_at(pivot.position)
func _process(delta): func _process(delta):
if Global.player == null: if Global.player == null:
return return
center.position = lerp(center.position, Global.player.position, follow_speed * delta) follow.position = lerp(follow.position, Global.player.position, follow_speed * delta)
# @export var shake_strength: float # @export var shake_strength: float
# var noise = FastNoiseLite.new() # var noise = FastNoiseLite.new()

View File

@ -1,3 +1,4 @@
class_name AnimationController
extends Node extends Node
@export var character: Character @export var character: Character

View File

@ -1,10 +1,12 @@
[gd_scene load_steps=8 format=3 uid="uid://2lcnu3dy54lx"] [gd_scene load_steps=10 format=3 uid="uid://2lcnu3dy54lx"]
[ext_resource type="Script" path="res://player/Player.gd" id="1_8gebs"] [ext_resource type="Script" path="res://player/Player.gd" id="1_8gebs"]
[ext_resource type="PackedScene" uid="uid://dnr3o1rbkqpgu" path="res://assets/female/Female.blend" id="2_8nah6"] [ext_resource type="PackedScene" uid="uid://dnr3o1rbkqpgu" path="res://assets/female/Female.blend" id="2_8nah6"]
[ext_resource type="PackedScene" uid="uid://2bbycjulf00g" path="res://character/health/HealthComponent.tscn" id="2_np5ag"] [ext_resource type="PackedScene" uid="uid://2bbycjulf00g" path="res://character/health/HealthComponent.tscn" id="2_np5ag"]
[ext_resource type="PackedScene" uid="uid://dlhdudao4ondv" path="res://assets/sword/Sword.blend" id="3_c4wr7"]
[ext_resource type="PackedScene" uid="uid://cgqbkj8wbcatv" path="res://assets/hair/PonyTail.blend" id="3_umw6q"]
[ext_resource type="FontFile" uid="uid://b7mov13kwi8u8" path="res://assets/font/ubuntu_nf_regular.ttf" id="4_76ehj"] [ext_resource type="FontFile" uid="uid://b7mov13kwi8u8" path="res://assets/font/ubuntu_nf_regular.ttf" id="4_76ehj"]
[ext_resource type="Script" path="res://player/Animation.gd" id="5_d4uw4"] [ext_resource type="Script" path="res://player/AnimationController.gd" id="4_i2ybk"]
[ext_resource type="AnimationLibrary" uid="uid://c355hn01ye2hd" path="res://assets/animations/human.blend" id="6_fl6or"] [ext_resource type="AnimationLibrary" uid="uid://c355hn01ye2hd" path="res://assets/animations/human.blend" id="6_fl6or"]
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_2f50n"] [sub_resource type="CapsuleShape3D" id="CapsuleShape3D_2f50n"]
@ -19,6 +21,20 @@ model = NodePath("Model")
[node name="Female" parent="Model" instance=ExtResource("2_8nah6")] [node name="Female" parent="Model" instance=ExtResource("2_8nah6")]
[node name="BoneAttachment3D" type="BoneAttachment3D" parent="Model/Female/Armature/GeneralSkeleton" index="2"]
transform = Transform3D(0, -1, 0, 0, 0, -1, 1, 0, 0, -0.609469, 1.26691, -0.0234125)
bone_name = "RightMiddleProximal"
bone_idx = 44
[node name="Sword" parent="Model/Female/Armature/GeneralSkeleton/BoneAttachment3D" instance=ExtResource("3_c4wr7")]
[node name="BoneAttachment3D2" type="BoneAttachment3D" parent="Model/Female/Armature/GeneralSkeleton" index="3"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.57651e-10, 1.37156, -0.0247111)
bone_name = "Head"
bone_idx = 12
[node name="PonyTail" parent="Model/Female/Armature/GeneralSkeleton/BoneAttachment3D2" instance=ExtResource("3_umw6q")]
[node name="Collision" type="CollisionShape3D" parent="."] [node name="Collision" type="CollisionShape3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.8, 0) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.8, 0)
shape = SubResource("CapsuleShape3D_2f50n") shape = SubResource("CapsuleShape3D_2f50n")
@ -35,7 +51,7 @@ font_size = 128
outline_size = 6 outline_size = 6
[node name="Animation" type="Node" parent="." node_paths=PackedStringArray("character", "animation_player")] [node name="Animation" type="Node" parent="." node_paths=PackedStringArray("character", "animation_player")]
script = ExtResource("5_d4uw4") script = ExtResource("4_i2ybk")
character = NodePath("..") character = NodePath("..")
animation_player = NodePath("../AnimationPlayer") animation_player = NodePath("../AnimationPlayer")
@ -47,3 +63,5 @@ libraries = {
"human": ExtResource("6_fl6or") "human": ExtResource("6_fl6or")
} }
playback_default_blend_time = 0.2 playback_default_blend_time = 0.2
[editable path="Model/Female"]