diff --git a/blends/giant.blend b/blends/giant.blend index 8ad30f1..2db30cd 100644 Binary files a/blends/giant.blend and b/blends/giant.blend differ diff --git a/blends/giant.blend1 b/blends/giant.blend1 new file mode 100644 index 0000000..dc956fe Binary files /dev/null and b/blends/giant.blend1 differ diff --git a/godot/Models/grape_animations/idle.res b/godot/Models/grape_animations/idle.res index c9e4368..6c85dd2 100644 Binary files a/godot/Models/grape_animations/idle.res and b/godot/Models/grape_animations/idle.res differ diff --git a/godot/Models/grape_animations/pickup.res b/godot/Models/grape_animations/pickup.res index f015895..199e933 100644 Binary files a/godot/Models/grape_animations/pickup.res and b/godot/Models/grape_animations/pickup.res differ diff --git a/godot/Models/grape_animations/upper_body_holding.res b/godot/Models/grape_animations/upper_body_holding.res index c60260a..61761e3 100644 Binary files a/godot/Models/grape_animations/upper_body_holding.res and b/godot/Models/grape_animations/upper_body_holding.res differ diff --git a/godot/Models/grape_animations/upper_body_idle.res.res b/godot/Models/grape_animations/upper_body_idle.res.res index d855dc3..a023e5d 100644 Binary files a/godot/Models/grape_animations/upper_body_idle.res.res and b/godot/Models/grape_animations/upper_body_idle.res.res differ diff --git a/godot/Models/grape_animations/walk.res b/godot/Models/grape_animations/walk.res index f147a97..ab7ac5f 100644 Binary files a/godot/Models/grape_animations/walk.res and b/godot/Models/grape_animations/walk.res differ diff --git a/godot/Models/grape_man.gd b/godot/Models/grape_man.gd index 74d4784..8195d33 100644 --- a/godot/Models/grape_man.gd +++ b/godot/Models/grape_man.gd @@ -2,8 +2,6 @@ extends Node3D @onready var animation: AnimationNodeStateMachinePlayback = $AnimationTree.get("parameters/playback") - - signal anim_check_grab(position: Vector3) var pickup_animation_in_progress = false diff --git a/godot/Models/grape_man.glb b/godot/Models/grape_man.glb index 8dd0c30..c21386a 100644 --- a/godot/Models/grape_man.glb +++ b/godot/Models/grape_man.glb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:376f8e3fdfb0806d6b156ff11b215595edd01bc68c445bdc8134a274af403abd -size 654428 +oid sha256:6c07b7b68ef5daf21301084c31b4e5cc47f06d9c67a10aa4038853fb36ca14cf +size 659020 diff --git a/godot/Models/grape_man.tscn b/godot/Models/grape_man.tscn index 2919955..56a4369 100644 --- a/godot/Models/grape_man.tscn +++ b/godot/Models/grape_man.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=38 format=3 uid="uid://bgoo1lbt28na"] +[gd_scene load_steps=37 format=3 uid="uid://bgoo1lbt28na"] [ext_resource type="PackedScene" uid="uid://bhanbx2dyhv2d" path="res://Models/grape_man.glb" id="1_fh5yr"] [ext_resource type="Script" path="res://Models/grape_man.gd" id="2_ksje8"] @@ -135,21 +135,18 @@ xfade_time = 0.3 [sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_y2dr5"] xfade_time = 0.3 -[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_ubbuf"] -xfade_time = 0.3 - [sub_resource type="AnimationNodeStateMachine" id="AnimationNodeStateMachine_6mfdu"] states/IdleEmpty/node = SubResource("AnimationNodeBlendTree_ojr1k") states/IdleEmpty/position = Vector2(315, 186) states/IdleHold/node = SubResource("AnimationNodeBlendTree_v72vt") states/IdleHold/position = Vector2(592, 349) states/Pickup/node = SubResource("AnimationNodeAnimation_rrdxi") -states/Pickup/position = Vector2(711, 105) +states/Pickup/position = Vector2(734, 117) states/WalkEmpty/node = SubResource("AnimationNodeBlendTree_6rmmo") -states/WalkEmpty/position = Vector2(619, 219) +states/WalkEmpty/position = Vector2(548, 208) states/WalkHold/node = SubResource("AnimationNodeBlendTree_kalnq") states/WalkHold/position = Vector2(351, 323) -transitions = ["Start", "IdleEmpty", SubResource("AnimationNodeStateMachineTransition_8sw6d"), "IdleEmpty", "WalkHold", SubResource("AnimationNodeStateMachineTransition_71rn8"), "WalkHold", "IdleEmpty", SubResource("AnimationNodeStateMachineTransition_cp7lp"), "WalkEmpty", "IdleEmpty", SubResource("AnimationNodeStateMachineTransition_27n2r"), "IdleEmpty", "WalkEmpty", SubResource("AnimationNodeStateMachineTransition_v26jl"), "IdleHold", "WalkHold", SubResource("AnimationNodeStateMachineTransition_u0rau"), "IdleHold", "WalkEmpty", SubResource("AnimationNodeStateMachineTransition_1hqga"), "WalkEmpty", "IdleHold", SubResource("AnimationNodeStateMachineTransition_uekhs"), "WalkHold", "IdleHold", SubResource("AnimationNodeStateMachineTransition_652wi"), "IdleEmpty", "Pickup", SubResource("AnimationNodeStateMachineTransition_sdgve"), "Pickup", "IdleEmpty", SubResource("AnimationNodeStateMachineTransition_otprv"), "IdleEmpty", "IdleHold", SubResource("AnimationNodeStateMachineTransition_fbwhh"), "IdleHold", "IdleEmpty", SubResource("AnimationNodeStateMachineTransition_4rq7a"), "WalkHold", "WalkEmpty", SubResource("AnimationNodeStateMachineTransition_oange"), "WalkEmpty", "WalkHold", SubResource("AnimationNodeStateMachineTransition_et4tx"), "Pickup", "IdleHold", SubResource("AnimationNodeStateMachineTransition_y2dr5"), "IdleHold", "Pickup", SubResource("AnimationNodeStateMachineTransition_ubbuf")] +transitions = ["Start", "IdleEmpty", SubResource("AnimationNodeStateMachineTransition_8sw6d"), "IdleEmpty", "WalkHold", SubResource("AnimationNodeStateMachineTransition_71rn8"), "WalkHold", "IdleEmpty", SubResource("AnimationNodeStateMachineTransition_cp7lp"), "WalkEmpty", "IdleEmpty", SubResource("AnimationNodeStateMachineTransition_27n2r"), "IdleEmpty", "WalkEmpty", SubResource("AnimationNodeStateMachineTransition_v26jl"), "IdleHold", "WalkHold", SubResource("AnimationNodeStateMachineTransition_u0rau"), "IdleHold", "WalkEmpty", SubResource("AnimationNodeStateMachineTransition_1hqga"), "WalkEmpty", "IdleHold", SubResource("AnimationNodeStateMachineTransition_uekhs"), "WalkHold", "IdleHold", SubResource("AnimationNodeStateMachineTransition_652wi"), "IdleEmpty", "Pickup", SubResource("AnimationNodeStateMachineTransition_sdgve"), "Pickup", "IdleEmpty", SubResource("AnimationNodeStateMachineTransition_otprv"), "IdleEmpty", "IdleHold", SubResource("AnimationNodeStateMachineTransition_fbwhh"), "IdleHold", "IdleEmpty", SubResource("AnimationNodeStateMachineTransition_4rq7a"), "WalkHold", "WalkEmpty", SubResource("AnimationNodeStateMachineTransition_oange"), "WalkEmpty", "WalkHold", SubResource("AnimationNodeStateMachineTransition_et4tx"), "Pickup", "IdleHold", SubResource("AnimationNodeStateMachineTransition_y2dr5")] graph_offset = Vector2(26, 89) [node name="grape_man" instance=ExtResource("1_fh5yr")] @@ -157,7 +154,7 @@ transform = Transform3D(0.065, 0, 0, 0, 0.065, 0, 0, 0, 0.065, 0, 0, 0) script = ExtResource("2_ksje8") [node name="Skeleton3D" parent="rig" index="0"] -bones/0/rotation = Quaternion(0.08892, 0, 0, 0.996039) +bones/0/rotation = Quaternion(0.0861766, 0, 0, 0.99628) bones/1/rotation = Quaternion(-0.0891896, 1.18734e-07, -1.06322e-08, 0.996015) bones/2/rotation = Quaternion(0.0133933, -1.19199e-07, 1.5966e-09, 0.99991) bones/3/rotation = Quaternion(-0.00997737, 0.100365, -0.694951, 0.711948) diff --git a/godot/Player.gd b/godot/Player.gd index 5868dcc..b7670f6 100644 --- a/godot/Player.gd +++ b/godot/Player.gd @@ -6,6 +6,7 @@ const JUMP_VELOCITY = 4.5 @export var horiz_sens = 0.25 @export var vert_sens = 0.25 + var holding: WeakRef = weakref(null) # Get the gravity from the project settings to be synced with RigidBody nodes. @@ -29,9 +30,21 @@ func _input(event): $CameraMount.rotate_x(deg_to_rad(-event.relative.y * vert_sens)) $grape_man.rotate_y(deg_to_rad(event.relative.x * horiz_sens)) $CameraMount.global_rotation.x = clampf($CameraMount.global_rotation.x, deg_to_rad(-60), deg_to_rad(-11)) + + if Input.is_action_just_pressed("ui_accept"): + var obj = holding.get_ref() + if obj: + holding = weakref(null) + else: + $grape_man.pickup() + + func _physics_process(delta): + if $grape_man.pickup_animation_in_progress: + return + # Add the gravity. if not is_on_floor(): velocity.y -= gravity * delta @@ -40,6 +53,10 @@ func _physics_process(delta): # Get the input direction and handle the movement/deceleration. # As good practice, you should replace UI actions with custom gameplay actions. var input_dir = Input.get_vector("ui_left", "ui_right", "ui_up", "ui_down") + + + + var direction = (transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized() if direction: velocity.x = direction.x * SPEED @@ -49,10 +66,20 @@ func _physics_process(delta): $grape_man.global_position.y, $grape_man.global_position.z - velocity.z, )) - $grape_man.walk_empty() + if holding.get_ref(): + $grape_man.walk_hold() + else: + $grape_man.walk_empty() else: - $grape_man.idle_empty() + if holding.get_ref(): + $grape_man.idle_hold() + else: + $grape_man.idle_empty() velocity.x = move_toward(velocity.x, 0, SPEED) velocity.z = move_toward(velocity.z, 0, SPEED) move_and_slide() + + +func _on_grape_man_anim_check_grab(_position): + holding = weakref(self) diff --git a/godot/player.tscn b/godot/player.tscn index a5461a2..c4044d8 100644 --- a/godot/player.tscn +++ b/godot/player.tscn @@ -20,3 +20,5 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.3, 0) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1.39043) current = true fov = 50.0 + +[connection signal="anim_check_grab" from="grape_man" to="." method="_on_grape_man_anim_check_grab"]