Compare commits

...

4 Commits

Author SHA1 Message Date
Spencer Killen 7adfcc2766
a 2023-08-19 18:58:08 -06:00
Spencer Killen 4ef9927141
a 2023-08-19 18:56:38 -06:00
Spencer Killen db3240dd4c
Merge branch 'master' of https://git.sjkillen.ca/sjkillen/ABGJ-23 2023-08-19 18:44:52 -06:00
Spencer Killen 62d8ce3b30
a 2023-08-19 18:18:34 -06:00
11 changed files with 53 additions and 23 deletions

7
godot/Holster.gd Normal file
View File

@ -0,0 +1,7 @@
extends Node3D
func _ready():
set_as_top_level(true)
func _process(delta):
global_transform.origin = $"../grape_man".get_pickup_bone_location()

View File

@ -1,6 +1,7 @@
extends Node3D
@onready var animation: AnimationNodeStateMachinePlayback = $AnimationTree.get("parameters/playback")
@onready var pickup_bone_idx = $rig/Skeleton3D.find_bone("PickupBone")
signal anim_check_grab(position: Vector3)
@ -28,7 +29,11 @@ func idle_hold():
animation.travel("IdleHold")
func animation_key_grab():
emit_signal("anim_check_grab", $GrabPointLocation.global_transform)
emit_signal("anim_check_grab", get_pickup_bone_location())
func get_pickup_bone_location() -> Vector3:
var trans = $rig/Skeleton3D.global_transform * $rig/Skeleton3D.get_bone_global_pose(pickup_bone_idx)
return trans.origin
func animation_key_pickup_completed():
pickup_animation_in_progress = false

View File

@ -1,10 +1,12 @@
[gd_scene load_steps=37 format=3 uid="uid://bgoo1lbt28na"]
[gd_scene load_steps=40 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"]
[ext_resource type="AudioStream" uid="uid://csboqs15k3vps" path="res://Sounds/dropgrunt.ogg" id="3_c648b"]
[ext_resource type="AudioStream" uid="uid://baocyd0p3jcku" path="res://Sounds/pickup_grunt.ogg" id="4_nvurj"]
[ext_resource type="AudioStream" uid="uid://b80t5xqckjoqk" path="res://Sounds/heartychuckle.ogg" id="5_b32re"]
[sub_resource type="AnimationNodeAdd2" id="AnimationNodeAdd2_a0vxm"]
filter_enabled = true
filters = ["rig/Skeleton3D:forearm.L", "rig/Skeleton3D:forearm.R", "rig/Skeleton3D:head", "rig/Skeleton3D:upper_arm.L", "rig/Skeleton3D:upper_arm.R"]
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_s8uqe"]
@ -14,7 +16,7 @@ animation = &"UpperBodyIdle"
animation = &"Idle"
[sub_resource type="AnimationNodeBlendTree" id="AnimationNodeBlendTree_ojr1k"]
graph_offset = Vector2(-312, -69)
graph_offset = Vector2(-74, 44)
nodes/Add2/node = SubResource("AnimationNodeAdd2_a0vxm")
nodes/Add2/position = Vector2(160, 80)
nodes/Animation/node = SubResource("AnimationNodeAnimation_4ft7i")
@ -24,7 +26,6 @@ nodes/Animation/position = Vector2(0, 80)
node_connections = [&"output", 0, &"Add2", &"Add2", 0, &"Animation", &"Add2", 1, &"Animation 2"]
[sub_resource type="AnimationNodeAdd2" id="AnimationNodeAdd2_4gk6k"]
filter_enabled = true
filters = ["rig/Skeleton3D:forearm.L", "rig/Skeleton3D:forearm.R", "rig/Skeleton3D:head", "rig/Skeleton3D:upper_arm.L", "rig/Skeleton3D:upper_arm.R"]
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_alnh1"]
@ -48,7 +49,6 @@ node_connections = [&"output", 0, &"Add2", &"Add2", 0, &"Animation", &"Add2", 1,
animation = &"Pickup"
[sub_resource type="AnimationNodeAdd2" id="AnimationNodeAdd2_rd6bn"]
filter_enabled = true
filters = ["rig/Skeleton3D:forearm.L", "rig/Skeleton3D:forearm.R", "rig/Skeleton3D:head", "rig/Skeleton3D:upper_arm.L", "rig/Skeleton3D:upper_arm.R"]
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_7s7tg"]
@ -58,7 +58,7 @@ animation = &"UpperBodyIdle"
animation = &"Walk"
[sub_resource type="AnimationNodeBlendTree" id="AnimationNodeBlendTree_6rmmo"]
graph_offset = Vector2(-358.186, -79.7423)
graph_offset = Vector2(-384.186, 6.2577)
nodes/Add2/node = SubResource("AnimationNodeAdd2_rd6bn")
nodes/Add2/position = Vector2(140, 80)
nodes/Animation/node = SubResource("AnimationNodeAnimation_ir63n")
@ -68,7 +68,6 @@ nodes/Animation/position = Vector2(-40, 60)
node_connections = [&"output", 0, &"Add2", &"Add2", 0, &"Animation", &"Add2", 1, &"Animation 2"]
[sub_resource type="AnimationNodeAdd2" id="AnimationNodeAdd2_sv87c"]
filter_enabled = true
filters = ["rig/Skeleton3D:forearm.L", "rig/Skeleton3D:forearm.R", "rig/Skeleton3D:head", "rig/Skeleton3D:upper_arm.L", "rig/Skeleton3D:upper_arm.R"]
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_y7bu0"]
@ -147,14 +146,14 @@ 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")]
graph_offset = Vector2(26, 89)
graph_offset = Vector2(3, 172)
[node name="grape_man" instance=ExtResource("1_fh5yr")]
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.0889611, 0, 0, 0.996035)
bones/0/rotation = Quaternion(0.10292, 0, 0, 0.99469)
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)
@ -181,3 +180,12 @@ parameters/IdleEmpty/Add2/add_amount = 1.0
parameters/IdleHold/Add2/add_amount = 1.0
parameters/WalkEmpty/Add2/add_amount = 1.0
parameters/WalkHold/Add2/add_amount = 1.0
[node name="drop" type="AudioStreamPlayer" parent="." index="5"]
stream = ExtResource("3_c648b")
[node name="pickup" type="AudioStreamPlayer" parent="." index="6"]
stream = ExtResource("4_nvurj")
[node name="chuckle" type="AudioStreamPlayer" parent="." index="7"]
stream = ExtResource("5_b32re")

View File

@ -35,7 +35,9 @@ func _input(event):
var obj = holding.get_ref()
if obj:
holding = weakref(null)
$grape_man/drop.play()
else:
$grape_man/pickup.play()
$grape_man.pickup()

View File

@ -18,7 +18,7 @@ force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_mode=2
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0

View File

@ -18,7 +18,7 @@ force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_mode=2
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0

View File

@ -1,20 +1,23 @@
[gd_scene load_steps=4 format=3 uid="uid://7utef1nnena8"]
[gd_scene load_steps=6 format=3 uid="uid://7utef1nnena8"]
[ext_resource type="Script" path="res://Player.gd" id="1_7gpdp"]
[ext_resource type="PackedScene" uid="uid://bgoo1lbt28na" path="res://Models/grape_man.tscn" id="2_hg0av"]
[ext_resource type="PackedScene" uid="uid://bgoo1lbt28na" path="res://Models/grape_man.tscn" id="2_ctyy5"]
[ext_resource type="Script" path="res://Holster.gd" id="3_a68da"]
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_kb4ms"]
radius = 0.06
height = 0.43
[sub_resource type="SphereShape3D" id="SphereShape3D_6l1w6"]
[node name="Player" type="CharacterBody3D"]
script = ExtResource("1_7gpdp")
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
transform = Transform3D(0.225, 0, 0, 0, 0.225, 0, 0, 0, 0.145, 0, 0.21, 0)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.21, 0)
shape = SubResource("CapsuleShape3D_kb4ms")
[node name="grape_man" parent="." instance=ExtResource("2_hg0av")]
[node name="grape_man" parent="." instance=ExtResource("2_ctyy5")]
[node name="CameraMount" type="Node3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.3, 0)
@ -24,4 +27,11 @@ 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"]
[node name="Holster" type="Node3D" parent="."]
script = ExtResource("3_a68da")
[node name="Area3D" type="Area3D" parent="Holster"]
[node name="CollisionShape3D" type="CollisionShape3D" parent="Holster/Area3D"]
transform = Transform3D(0.1, 0, 0, 0, 0.1, 0, 0, 0, 0.1, 0, 0, 0)
shape = SubResource("SphereShape3D_6l1w6")

View File

@ -6,13 +6,11 @@
[sub_resource type="CapsuleMesh" id="CapsuleMesh_b3srs"]
[node name="Node3D" type="Node3D"]
[node name="CharacterBody3D" type="CharacterBody3D"]
script = ExtResource("1_ardgw")
[node name="RigidBody3D" type="RigidBody3D" parent="."]
[node name="CollisionShape3D" type="CollisionShape3D" parent="RigidBody3D"]
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
shape = SubResource("CapsuleShape3D_s4x8n")
[node name="MeshInstance3D" type="MeshInstance3D" parent="RigidBody3D/CollisionShape3D"]
[node name="MeshInstance3D" type="MeshInstance3D" parent="CollisionShape3D"]
mesh = SubResource("CapsuleMesh_b3srs")