Giant pickups
This commit is contained in:
parent
f9b21c3bf6
commit
73be2a700c
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,7 @@
|
|||
extends Node3D
|
||||
|
||||
func _ready():
|
||||
set_as_top_level(true)
|
||||
|
||||
func _process(_delta):
|
||||
global_transform.origin = $"..".get_pickup_bone_location()
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
godot/Models/grape_man.glb (Stored with Git LFS)
BIN
godot/Models/grape_man.glb (Stored with Git LFS)
Binary file not shown.
|
@ -153,7 +153,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.10292, 0, 0, 0.99469)
|
||||
bones/0/rotation = Quaternion(0.0962932, 0, 0, 0.995353)
|
||||
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)
|
||||
|
@ -166,13 +166,10 @@ bones/7/rotation = Quaternion(0.0142813, -6.34259e-18, -4.44044e-16, 0.999898)
|
|||
bones/10/rotation = Quaternion(0.105246, 0.0039338, -0.0113526, 0.994374)
|
||||
bones/15/rotation = Quaternion(0.105246, -0.0039338, 0.0113526, 0.994374)
|
||||
|
||||
[node name="GrabPointLocation" type="Node3D" parent="." index="2"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1.29365)
|
||||
|
||||
[node name="OmniLight3D" type="OmniLight3D" parent="." index="3"]
|
||||
[node name="OmniLight3D" type="OmniLight3D" parent="." index="2"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.289473, 8.26292, 4.26359)
|
||||
|
||||
[node name="AnimationTree" type="AnimationTree" parent="." index="4"]
|
||||
[node name="AnimationTree" type="AnimationTree" parent="." index="3"]
|
||||
tree_root = SubResource("AnimationNodeStateMachine_6mfdu")
|
||||
anim_player = NodePath("../AnimationPlayer")
|
||||
active = true
|
||||
|
@ -181,11 +178,11 @@ 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"]
|
||||
[node name="drop" type="AudioStreamPlayer" parent="." index="4"]
|
||||
stream = ExtResource("3_c648b")
|
||||
|
||||
[node name="pickup" type="AudioStreamPlayer" parent="." index="6"]
|
||||
[node name="pickup" type="AudioStreamPlayer" parent="." index="5"]
|
||||
stream = ExtResource("4_nvurj")
|
||||
|
||||
[node name="chuckle" type="AudioStreamPlayer" parent="." index="7"]
|
||||
[node name="chuckle" type="AudioStreamPlayer" parent="." index="6"]
|
||||
stream = ExtResource("5_b32re")
|
||||
|
|
|
@ -29,13 +29,13 @@ transitions = ["Walk", "Idle", SubResource("AnimationNodeStateMachineTransition_
|
|||
script = ExtResource("2_xo27e")
|
||||
|
||||
[node name="Skeleton3D" parent="Armature" index="0"]
|
||||
bones/1/position = Vector3(0, 0.437354, 0)
|
||||
bones/1/position = Vector3(0, 0.419783, 0)
|
||||
bones/2/rotation = Quaternion(-0.0627444, 0.00212883, -0.213248, 0.974979)
|
||||
bones/3/rotation = Quaternion(0.100834, -0.698956, 0.0125015, 0.707911)
|
||||
bones/7/rotation = Quaternion(-0.236485, 2.38279e-09, 2.70266e-09, 0.971635)
|
||||
bones/8/rotation = Quaternion(0.263182, -9.32379e-10, -4.07392e-10, 0.964746)
|
||||
bones/10/rotation = Quaternion(0.224729, -5.42036e-08, -5.94067e-08, 0.974421)
|
||||
bones/11/rotation = Quaternion(-0.270178, 7.30152e-08, 3.38983e-08, 0.962811)
|
||||
bones/7/rotation = Quaternion(-0.259966, 2.31658e-09, 2.75962e-09, 0.965618)
|
||||
bones/8/rotation = Quaternion(0.184716, -8.96583e-10, -4.81081e-10, 0.982792)
|
||||
bones/10/rotation = Quaternion(0.255235, -5.60434e-08, -5.76742e-08, 0.966879)
|
||||
bones/11/rotation = Quaternion(-0.18748, 7.5629e-08, 2.75785e-08, 0.982268)
|
||||
|
||||
[node name="AnimationTree" type="AnimationTree" parent="." index="2"]
|
||||
tree_root = SubResource("AnimationNodeStateMachine_prt7l")
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
extends CharacterBody3D
|
||||
|
||||
|
||||
const SPEED = 5.0
|
||||
const SPEED = 0.5
|
||||
const JUMP_VELOCITY = 4.5
|
||||
@export var horiz_sens = 0.25
|
||||
@export var vert_sens = 0.25
|
||||
|
||||
|
||||
var target: WeakRef = weakref(null)
|
||||
var holding: WeakRef = weakref(null)
|
||||
|
||||
# Get the gravity from the project settings to be synced with RigidBody nodes.
|
||||
|
@ -22,6 +23,10 @@ func _process(_delta):
|
|||
if Input.is_action_pressed("ui_cancel"):
|
||||
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
|
||||
|
||||
var obj = holding.get_ref()
|
||||
if obj:
|
||||
obj.global_transform.origin = $grape_man.get_pickup_bone_location()
|
||||
|
||||
|
||||
func _input(event):
|
||||
# Handle the rotation of the camera using mouse movement.
|
||||
|
@ -34,7 +39,7 @@ func _input(event):
|
|||
if Input.is_action_just_pressed("ui_accept"):
|
||||
var obj = holding.get_ref()
|
||||
if obj:
|
||||
holding = weakref(null)
|
||||
drop()
|
||||
$grape_man/drop.play()
|
||||
else:
|
||||
$grape_man/pickup.play()
|
||||
|
@ -82,6 +87,31 @@ func _physics_process(delta):
|
|||
|
||||
move_and_slide()
|
||||
|
||||
func drop():
|
||||
var obj = holding.get_ref()
|
||||
if not obj:
|
||||
print("dropped, but wasn't holding anything?")
|
||||
return
|
||||
remove_collision_exception_with(obj)
|
||||
obj.set_process(true)
|
||||
holding = weakref(null)
|
||||
|
||||
func _on_grape_man_anim_check_grab(_position):
|
||||
holding = weakref(self)
|
||||
var obj = target.get_ref()
|
||||
if not obj:
|
||||
return
|
||||
holding = target
|
||||
target = weakref(null)
|
||||
|
||||
add_collision_exception_with(obj)
|
||||
obj.set_process(false)
|
||||
|
||||
func _on_holster_enter(body):
|
||||
if target.get_ref() or holding.get_ref() or "is_holdable" not in body:
|
||||
return
|
||||
target = weakref(body)
|
||||
|
||||
func _on_holster_exit(body):
|
||||
if target.get_ref() or holding.get_ref() or "is_holdable" not in body:
|
||||
return
|
||||
target = weakref(null)
|
||||
|
|
|
@ -35,3 +35,7 @@ script = ExtResource("3_a68da")
|
|||
[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")
|
||||
|
||||
[connection signal="anim_check_grab" from="grape_man" to="." method="_on_grape_man_anim_check_grab"]
|
||||
[connection signal="body_entered" from="Holster/Area3D" to="." method="_on_holster_enter"]
|
||||
[connection signal="body_exited" from="Holster/Area3D" to="." method="_on_holster_exit"]
|
||||
|
|
|
@ -1 +1,12 @@
|
|||
extends CharacterBody3D
|
||||
|
||||
var is_holdable: bool = true
|
||||
|
||||
func _ready():
|
||||
$slime.idle()
|
||||
|
||||
func walk():
|
||||
$slime.walk()
|
||||
|
||||
func idle():
|
||||
$slime.idle()
|
||||
|
|
|
@ -1,9 +1,17 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://dmtmign72vtlm"]
|
||||
[gd_scene load_steps=4 format=3 uid="uid://dmtmign72vtlm"]
|
||||
|
||||
[ext_resource type="Script" path="res://slime_shared.gd" id="1_gmj2r"]
|
||||
[ext_resource type="PackedScene" uid="uid://c3q6fva1c1baa" path="res://Models/slime.tscn" id="2_6u4ex"]
|
||||
|
||||
[sub_resource type="SphereShape3D" id="SphereShape3D_k5rhc"]
|
||||
radius = 0.05
|
||||
|
||||
[node name="slime_shared" type="CharacterBody3D"]
|
||||
script = ExtResource("1_gmj2r")
|
||||
|
||||
[node name="slime" parent="." instance=ExtResource("2_6u4ex")]
|
||||
transform = Transform3D(0.035, 0, 0, 0, 0.035, 0, 0, 0, 0.035, 0, 0, 0)
|
||||
|
||||
[node name="slime_collision" type="CollisionShape3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.0408143, 0)
|
||||
shape = SubResource("SphereShape3D_k5rhc")
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
[gd_scene load_steps=5 format=3 uid="uid://bax01mdng0pbb"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://dmtmign72vtlm" path="res://slime_shared.tscn" id="2_dchwa"]
|
||||
[ext_resource type="PackedScene" uid="uid://7utef1nnena8" path="res://player.tscn" id="2_fy870"]
|
||||
|
||||
[sub_resource type="QuadMesh" id="QuadMesh_lasv3"]
|
||||
|
||||
[sub_resource type="ConcavePolygonShape3D" id="ConcavePolygonShape3D_x4p8c"]
|
||||
data = PackedVector3Array(0.5, -0.5, 0, -0.5, -0.5, 0, 0.5, 0.5, 0, -0.5, -0.5, 0, -0.5, 0.5, 0, 0.5, 0.5, 0)
|
||||
|
||||
[node name="test_pickup_slimes" type="Node3D"]
|
||||
|
||||
[node name="slime_shared" parent="." instance=ExtResource("2_dchwa")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.127323, 0.879136)
|
||||
|
||||
[node name="Player" parent="." instance=ExtResource("2_fy870")]
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
|
||||
transform = Transform3D(5.40443, 0, 0, 0, -2.36235e-07, 5.40443, 0, -5.40443, -2.36235e-07, 0, -0.129765, 0)
|
||||
mesh = SubResource("QuadMesh_lasv3")
|
||||
skeleton = NodePath("")
|
||||
|
||||
[node name="StaticBody3D" type="StaticBody3D" parent="MeshInstance3D"]
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="MeshInstance3D/StaticBody3D"]
|
||||
shape = SubResource("ConcavePolygonShape3D_x4p8c")
|
Loading…
Reference in New Issue