Animation vraiment basic de la main

This commit is contained in:
Victor Turgeon 2022-10-11 14:58:23 -04:00
parent dce110a9b3
commit 172eb8acbd
4 changed files with 103 additions and 20 deletions

View File

@ -105,30 +105,28 @@ theme = SubResource( 8 )
text = "New Game"
[node name="ActualHUD" type="Control" parent="."]
anchor_left = 0.037
anchor_top = 0.914
anchor_right = 0.037
anchor_bottom = 0.916
margin_right = 40.0
margin_bottom = 40.0
theme = SubResource( 10 )
[node name="SlapGauge" type="ColorRect" parent="ActualHUD"]
material = SubResource( 11 )
anchor_left = 12.875
anchor_top = 7.625
anchor_right = 12.875
anchor_bottom = 7.625
margin_left = -451.0
margin_top = 218.0
margin_right = -161.0
margin_bottom = 241.0
margin_right = 291.36
margin_bottom = 23.0
script = ExtResource( 1 )
[node name="SlapLabel" type="Label" parent="ActualHUD"]
[node name="SlapLabel" type="Label" parent="ActualHUD/SlapGauge"]
modulate = Color( 1, 1, 1, 0.611765 )
anchor_left = 12.662
anchor_top = 7.324
anchor_right = 12.662
anchor_bottom = 7.324
margin_left = -436.48
margin_top = 229.04
margin_right = -325.48
margin_bottom = 261.04
margin_left = -3683.2
margin_top = -169.452
margin_right = -3572.2
margin_bottom = -137.452
text = "Slap"

View File

@ -23,10 +23,12 @@ var gravity_vec = Vector3()
onready var head = $Head
onready var ground_check = $GroundCheck
onready var SlapGauge = $HUD/ActualHUD/SlapGauge
onready var slap_gauge = $HUD/ActualHUD/SlapGauge
onready var slap_animator = $HandMovement
func _ready():
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
slap_animator.current_animation = "basic_slap"
func _input(event):
if event is InputEventMouseMotion:
@ -82,8 +84,9 @@ func _physics_process(delta):
else:
slap -= delta * 8.0;
slap = clamp(slap, 0.0, 1.0)
SlapGauge.fill = slap;
slap_gauge.fill = slap
slap_animator.seek(slap, true)
direction = direction.normalized()
h_velocity = h_velocity.linear_interpolate(direction * speed, h_acceleration * delta)
@ -91,4 +94,7 @@ func _physics_process(delta):
movement.x = h_velocity.x + gravity_vec.x
movement.y = gravity_vec.y
# warning-ignore:return_value_discarded
move_and_slide(movement, Vector3.UP)

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=8 format=2]
[gd_scene load_steps=10 format=2]
[ext_resource path="res://Player.gd" type="Script" id=1]
[ext_resource path="res://BlenderStuff/Hand/protohand.obj" type="ArrayMesh" id=2]
@ -14,6 +14,72 @@ height = 3.0
albedo_texture = ExtResource( 3 )
uv1_triplanar = true
[sub_resource type="Animation" id=5]
length = 0.001
tracks/0/type = "value"
tracks/0/path = NodePath("Head/HandParent/Hand:transform")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Transform( -0.178665, 0.385633, 0.0293721, 0.386578, 0.177103, 0.0262457, 0.0115471, 0.0376593, -0.4242, 1.33036, -0.0718137, -2.73514 ) ]
}
tracks/1/type = "value"
tracks/1/path = NodePath("Head/HandParent/Hand:translation")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector3( 0.329, 1.317, 0 ) ]
}
tracks/2/type = "value"
tracks/2/path = NodePath("Head/HandParent/Hand:rotation_degrees")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector3( -20.757, 0, 0 ) ]
}
[sub_resource type="Animation" id=6]
resource_name = "basic_slap"
tracks/0/type = "value"
tracks/0/path = NodePath("Head/HandParent/Hand:translation")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 1 ),
"transitions": PoolRealArray( 1, 1 ),
"update": 0,
"values": [ Vector3( 0, 0, 0 ), Vector3( -0.103, 2.756, 0 ) ]
}
tracks/1/type = "value"
tracks/1/path = NodePath("Head/HandParent/Hand:rotation_degrees")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/keys = {
"times": PoolRealArray( 0, 1 ),
"transitions": PoolRealArray( 1, 1 ),
"update": 0,
"values": [ Vector3( 0, 0, 0 ), Vector3( -36.146, -1.281, 0 ) ]
}
[node name="Player" type="KinematicBody"]
script = ExtResource( 1 )
@ -29,13 +95,17 @@ shape = SubResource( 3 )
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.84218, 0 )
[node name="Camera" type="Camera" parent="Head"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.343071, -0.253136 )
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.0154071, 0.355, -0.246618 )
fov = 80.0
[node name="Hand" type="MeshInstance" parent="Head"]
transform = Transform( -0.178665, 0.385633, 0.029372, 0.386578, 0.177104, 0.0262457, 0.0115471, 0.0376592, -0.4242, 1.33036, -0.0718137, -2.73514 )
[node name="HandParent" type="Spatial" parent="Head"]
transform = Transform( 0.0807126, 0.49343, -0.00351894, 0.445393, -0.0713166, 0.215728, 0.212391, -0.0379586, -0.451053, 0.736, -0.075, -1.998 )
[node name="Hand" type="MeshInstance" parent="Head/HandParent"]
transform = Transform( 0.426025, 0, 0, 0, 0.398372, 0.150985, 0, -0.150985, 0.398372, 0.329, 1.317, 0 )
cast_shadow = 0
mesh = ExtResource( 2 )
skeleton = NodePath("../..")
skeleton = NodePath("../../..")
material/0 = SubResource( 4 )
[node name="GroundCheck" type="RayCast" parent="."]
@ -44,3 +114,7 @@ enabled = true
cast_to = Vector3( 0, -1.5, 0 )
[node name="HUD" parent="." instance=ExtResource( 4 )]
[node name="HandMovement" type="AnimationPlayer" parent="."]
anims/RESET = SubResource( 5 )
anims/basic_slap = SubResource( 6 )

View File

@ -16,6 +16,11 @@ config/icon="res://icon.png"
[display]
window/size/width=1920
window/size/height=1080
window/size/test_width=1280
window/size/test_height=720
window/stretch/mode="viewport"
window/stretch/aspect="keep"
[gui]