Better bullet sync

This commit is contained in:
2025-02-01 20:10:52 +01:00
parent 56d346da22
commit 60fc238abd
6 changed files with 51 additions and 53 deletions

View File

@ -32,6 +32,9 @@ tracks/0/keys = {
"values": [Vector3(0, 0, 0)]
}
[sub_resource type="Animation" id="Animation_fhivu"]
resource_name = "idle"
[sub_resource type="Animation" id="Animation_mkk0p"]
resource_name = "move"
length = 0.5
@ -67,9 +70,6 @@ tracks/0/keys = {
"values": [Vector3(0, 0, 0), Vector3(0, -0.01, -0.01), Vector3(0, 0, 0)]
}
[sub_resource type="Animation" id="Animation_fhivu"]
resource_name = "idle"
[sub_resource type="AnimationLibrary" id="AnimationLibrary_u1b6p"]
_data = {
"RESET": SubResource("Animation_falg4"),

View File

@ -32,6 +32,7 @@ var look_dir: Vector2
var moving = false
func _ready() -> void:
global_position = $"..".initial_position
_add_legs_to_first_view()
# -- TODO: It should not be hardcoded
# Define a format string with placeholder '%s'
var path_tmpl := "res://scenes/weapon/guns/%s/with_hands.tscn"
@ -49,7 +50,7 @@ func _ready() -> void:
func _input(event):
if multiplayer.get_unique_id() == get_multiplayer_authority():
if Input.is_action_just_pressed("jump"): jumping = true
if Input.is_action_pressed("shoot"): shooting = true
if Input.is_action_just_pressed("shoot"): shooting = true
if Input.is_action_just_released("shoot"): shooting = false
if event is InputEventMouseMotion and Input.mouse_mode == Input.MOUSE_MODE_CAPTURED:
look_dir = event.relative * 1
@ -137,7 +138,8 @@ func _add_legs_to_first_view() -> Error :
var skeleton: Skeleton3D = node.find_child("Skeleton3D")
var bone := skeleton.find_bone("mixamorig_Spine")
if bone != -1:
skeleton.set_bone_pose_scale(bone, Vector3(0, 0, 0))
print(bone)
skeleton.set_bone_pose_scale(bone, Vector3(0.0001, 0.0001, 0.0001))
add_child(node)
var animation_node: AnimationPlayer = node.find_child("AnimationPlayer")
if animation_node != null: