This commit is contained in:
Spencer Killen 2023-08-19 12:27:23 -06:00
parent bfe712c456
commit 5a9e2575bf
Signed by: sjkillen
GPG Key ID: F307025B65C860BA
10 changed files with 52 additions and 36 deletions

View File

@ -31,7 +31,7 @@ import_script/path=""
_subresources={
"animations": {
"Idle": {
"save_to_file/enabled": true,
"save_to_file/enabled": false,
"save_to_file/keep_custom_tracks": true,
"save_to_file/path": "res://Models/grape_animations/idle.res",
"settings/loop_mode": 1,
@ -1830,7 +1830,7 @@ _subresources={
"slices/amount": null
},
"Pickup": {
"save_to_file/enabled": true,
"save_to_file/enabled": false,
"save_to_file/keep_custom_tracks": true,
"save_to_file/path": "res://Models/grape_animations/pickup.res",
"settings/loop_mode": 0,
@ -3629,7 +3629,7 @@ _subresources={
"slices/amount": null
},
"UpperBodyHolding": {
"save_to_file/enabled": true,
"save_to_file/enabled": false,
"save_to_file/keep_custom_tracks": true,
"save_to_file/path": "res://Models/grape_animations/upper_body_holding.res",
"settings/loop_mode": 0,
@ -5428,7 +5428,7 @@ _subresources={
"slices/amount": null
},
"UpperBodyIdle": {
"save_to_file/enabled": true,
"save_to_file/enabled": false,
"save_to_file/keep_custom_tracks": true,
"save_to_file/path": "res://Models/grape_animations/upper_body_idle.res.res",
"settings/loop_mode": 0,
@ -7227,7 +7227,7 @@ _subresources={
"slices/amount": null
},
"Walk": {
"save_to_file/enabled": true,
"save_to_file/enabled": false,
"save_to_file/keep_custom_tracks": true,
"save_to_file/path": "res://Models/grape_animations/walk.res",
"settings/loop_mode": 1,
@ -9025,6 +9025,14 @@ _subresources={
"slice_99/start_frame": 0,
"slices/amount": null
}
},
"nodes": {
"PATH:AnimationPlayer": {
"import_tracks/position": 0,
"import_tracks/rotation": 0,
"import_tracks/scale": 0,
"optimizer/enabled": false
}
}
}
gltf/embedded_image_handling=1

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=3 format=3 uid="uid://bmx4xpa5svia3"]
[gd_scene load_steps=3 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"]
@ -8,18 +8,24 @@ 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.0912427, 0, 0, 0.995829)
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)
bones/4/rotation = Quaternion(0.0907207, -0.104937, 0.0616428, 0.988412)
bones/4/scale = Vector3(1, 1, 1)
bones/5/rotation = Quaternion(-0.00997737, -0.100365, 0.694951, 0.711948)
bones/6/rotation = Quaternion(0.0907207, 0.104937, -0.0616428, 0.988412)
bones/6/scale = Vector3(1, 1, 1)
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)
bones/0/position = Vector3(0.00830117, 0.985943, 0.124772)
bones/0/rotation = Quaternion(0.838567, 0.0312173, -0.0173838, 0.543623)
bones/1/rotation = Quaternion(-0.0865421, 0.000700139, 0.000169413, 0.996248)
bones/2/rotation = Quaternion(-0.111076, -0.0110209, 0.0529719, 0.992338)
bones/3/rotation = Quaternion(0.467612, 0.0653885, -0.582913, 0.661268)
bones/4/rotation = Quaternion(0.0687327, -0.0343696, -0.655545, 0.751236)
bones/4/scale = Vector3(1.06418, 1.06418, 1.06418)
bones/5/rotation = Quaternion(0.467612, -0.0653885, 0.582913, 0.661268)
bones/6/rotation = Quaternion(0.0687327, 0.0343696, 0.655545, 0.751236)
bones/6/scale = Vector3(1.06418, 1.06418, 1.06418)
bones/7/rotation = Quaternion(0.274903, 0.0722153, -0.0203558, 0.95854)
bones/8/rotation = Quaternion(0.197065, 6.31982e-16, -1.33238e-15, 0.98039)
bones/9/position = Vector3(0.155448, 0.891297, -0.0224623)
bones/9/rotation = Quaternion(0.91662, -0.0104789, -0.00138672, 0.39962)
bones/10/rotation = Quaternion(0.268897, 0.0200174, -0.0169533, 0.962812)
bones/14/position = Vector3(-0.155448, 0.891297, -0.0224622)
bones/14/rotation = Quaternion(0.966019, 0.00733452, 0.00761147, -0.258254)
bones/15/rotation = Quaternion(-0.0622384, -0.00553498, 0.0104557, 0.997991)
[node name="GrabPointLocation" type="Node3D" parent="." index="2"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1.29365)

View File

@ -5,16 +5,14 @@ const SPEED = 5.0
const JUMP_VELOCITY = 4.5
@export var horiz_sens = 0.25
@export var vert_sens = 0.25
var playerCam
var playerVisuals
# Get the gravity from the project settings to be synced with RigidBody nodes.
var gravity = ProjectSettings.get_setting("physics/3d/default_gravity")
func _ready():
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
playerCam = get_node("CameraMount") as Node3D
playerVisuals = get_node("grape_man") as Node3D
$grape_man.drop()
$CameraMount.global_rotation.x = clampf($CameraMount.global_rotation.x, deg_to_rad(-60), deg_to_rad(-11))
func _process(_delta):
@ -27,8 +25,8 @@ func _input(event):
# Handle the rotation of the camera using mouse movement.
if event is InputEventMouseMotion:
rotate_y(deg_to_rad(-event.relative.x * horiz_sens))
playerCam.rotate_x(deg_to_rad(event.relative.y * vert_sens))
playerVisuals.rotate_y(deg_to_rad(event.relative.x * horiz_sens))
$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))
func _physics_process(delta):
@ -44,7 +42,14 @@ func _physics_process(delta):
if direction:
velocity.x = direction.x * SPEED
velocity.z = direction.z * SPEED
$grape_man.look_at(Vector3(
$grape_man.global_position.x - velocity.x,
$grape_man.global_position.y,
$grape_man.global_position.z - velocity.z,
))
$grape_man.walk()
else:
$grape_man.idle()
velocity.x = move_toward(velocity.x, 0, SPEED)
velocity.z = move_toward(velocity.z, 0, SPEED)

View File

@ -1,25 +1,22 @@
[gd_scene load_steps=6 format=3 uid="uid://7utef1nnena8"]
[gd_scene load_steps=4 format=3 uid="uid://7utef1nnena8"]
[ext_resource type="Script" path="res://Player.gd" id="1_7gpdp"]
[ext_resource type="PackedScene" uid="uid://bmx4xpa5svia3" path="res://Models/grape_man.tscn" id="2_hha22"]
[ext_resource type="PackedScene" uid="uid://bgoo1lbt28na" path="res://Models/grape_man.tscn" id="2_hg0av"]
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_1yhh3"]
radius = 1.2
height = 5.8
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_kb4ms"]
[node name="Player" type="CharacterBody3D"]
script = ExtResource("1_7gpdp")
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 3, 0)
shape = SubResource("CapsuleShape3D_1yhh3")
shape = SubResource("CapsuleShape3D_kb4ms")
[node name="grape_man" parent="." instance=ExtResource("2_hha22")]
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 0, 0)
[node name="grape_man" parent="." instance=ExtResource("2_hg0av")]
[node name="CameraMount" type="Node3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 4.45879, 0)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.3, 0)
[node name="PlayerCam" type="Camera3D" parent="CameraMount"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 11.9417)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1.39043)
current = true
fov = 50.0

View File

@ -51,7 +51,7 @@ layout_mode = 2
text = "Walk"
[node name="Camera3D" type="Camera3D" parent="."]
transform = Transform3D(0.551151, 0, 0.834406, 0, 1, 0, -0.834406, 0, 0.551151, 1.041, 0.45, 0.03)
transform = Transform3D(0.947434, 0, 0.319952, 0, 1, 0, -0.319952, 0, 0.947434, 0.401511, 0.45, 0.732763)
[connection signal="pressed" from="CanvasLayer/Control/VBoxContainer/Pickup" to="." method="_on_pickup_pressed"]
[connection signal="pressed" from="CanvasLayer/Control/VBoxContainer/Hold" to="." method="_on_hold_pressed"]