This commit is contained in:
parent
5159ef9e27
commit
f6141f0462
@ -13,7 +13,7 @@ config_version=5
|
||||
config/name="Open Strike"
|
||||
run/main_scene="res://scenes/utils/menus/main/main_menu.tscn"
|
||||
config/features=PackedStringArray("4.3", "Forward Plus")
|
||||
run/max_fps=120
|
||||
run/max_fps=60
|
||||
config/icon="res://icon.svg"
|
||||
|
||||
[autoload]
|
||||
|
@ -1419,11 +1419,11 @@ shape = SubResource("SphereShape3D_axep3")
|
||||
[node name="PhysicalBoneSimulator3D" type="PhysicalBoneSimulator3D" parent="Body/Armature/Skeleton3D"]
|
||||
|
||||
[node name="Physical Bone mixamorig_Hips" type="PhysicalBone3D" parent="Body/Armature/Skeleton3D/PhysicalBoneSimulator3D"]
|
||||
transform = Transform3D(82.5044, -54.0559, -16.4615, 55.0482, 83.4649, 1.8195, 12.756, -10.5629, 98.619, 1.31498, 0.290626, -87.4646)
|
||||
transform = Transform3D(82.5044, -54.0559, -16.4615, 55.0482, 83.4649, 1.8195, 12.756, -10.5629, 98.619, 1.31498, 0.290625, -87.4646)
|
||||
collision_layer = 4
|
||||
collision_mask = 4
|
||||
joint_type = 1
|
||||
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.1131e-07, -8.84756e-09, 0.0499956)
|
||||
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.11306e-07, -5.58794e-09, 0.0499956)
|
||||
body_offset = Transform3D(100, -0.0695305, -0.00860918, -1.4782e-05, 12.2744, -99.2438, 0.0700493, 99.2438, 12.2744, 0.000441551, 4.96175, -0.613665)
|
||||
mass = 20.0
|
||||
bone_name = "mixamorig_Hips"
|
||||
@ -1440,7 +1440,7 @@ transform = Transform3D(80.9412, -58.546, -4.56913, 57.6046, 80.6695, -13.1964,
|
||||
collision_layer = 4
|
||||
collision_mask = 4
|
||||
joint_type = 1
|
||||
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 3.10335e-09, 5.59426e-10, 0.0586601)
|
||||
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 3.10332e-09, 5.59426e-10, 0.05866)
|
||||
body_offset = Transform3D(100, 7.62939e-06, 1.09673e-05, 4.76837e-06, 0, -100, -1.52588e-05, 100, -9.53674e-07, -9.53674e-07, 5.866, 0)
|
||||
mass = 20.0
|
||||
bone_name = "mixamorig_Spine"
|
||||
@ -1453,11 +1453,11 @@ transform = Transform3D(0.0318071, 3.86358e-14, 4.9738e-14, -2.13163e-14, -1.629
|
||||
shape = SubResource("CapsuleShape3D_126jt")
|
||||
|
||||
[node name="Physical Bone mixamorig_Head" type="PhysicalBone3D" parent="Body/Armature/Skeleton3D/PhysicalBoneSimulator3D"]
|
||||
transform = Transform3D(-97.8019, 4.4733, 20.366, -15.8369, -79.4709, -58.5966, 13.5638, -60.5339, 78.4325, -13.8193, 23.4986, -143.635)
|
||||
transform = Transform3D(-97.8019, 4.47329, 20.366, -15.8369, -79.4709, -58.5966, 13.5638, -60.5339, 78.4325, -13.8193, 23.4986, -143.635)
|
||||
collision_layer = 4
|
||||
collision_mask = 4
|
||||
joint_type = 1
|
||||
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -7.71773e-08, -1.37836e-07, 0.0981531)
|
||||
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -7.71765e-08, -1.39698e-07, 0.0981531)
|
||||
body_offset = Transform3D(-100, -0.00220013, -0.000778198, -5.24521e-06, 33.8066, -94.1122, 0.00232792, -94.1122, -33.8066, 6.86646e-05, 9.23741, 3.31821)
|
||||
mass = 7.0
|
||||
bone_name = "mixamorig_Head"
|
||||
@ -1470,11 +1470,11 @@ transform = Transform3D(0.01, 0, 0, 0, -4.37114e-10, 0.01, 0, -0.01, -4.37114e-1
|
||||
shape = SubResource("CapsuleShape3D_1gw5y")
|
||||
|
||||
[node name="Physical Bone mixamorig_LeftArm" type="PhysicalBone3D" parent="Body/Armature/Skeleton3D/PhysicalBoneSimulator3D"]
|
||||
transform = Transform3D(86.1165, 14.0252, -48.8594, -45.4995, 64.1262, -61.787, 22.6659, 75.4396, 61.6046, 16.1942, 31.0309, -132.592)
|
||||
transform = Transform3D(86.1165, 14.0252, -48.8594, -45.4995, 64.1262, -61.787, 22.6659, 75.4395, 61.6046, 16.1942, 31.0309, -132.592)
|
||||
collision_layer = 4
|
||||
collision_mask = 4
|
||||
joint_type = 1
|
||||
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -4.17129e-09, 2.34109e-07, 0.137023)
|
||||
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -4.17137e-09, 2.34109e-07, 0.137023)
|
||||
body_offset = Transform3D(100, -4.19617e-05, -2.47955e-05, 2.86102e-05, 100, -3.8147e-06, 1.71661e-05, -3.8147e-06, 100, 3.8147e-06, -2.28882e-05, -13.7023)
|
||||
mass = 3.0
|
||||
bone_name = "mixamorig_LeftArm"
|
||||
@ -1491,7 +1491,7 @@ transform = Transform3D(-48.2566, -12.058, 86.752, -78.7312, -37.4258, -48.997,
|
||||
collision_layer = 4
|
||||
collision_mask = 4
|
||||
joint_type = 1
|
||||
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -3.99826e-07, 6.04928e-08, 0.138072)
|
||||
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -3.99827e-07, 6.04928e-08, 0.138072)
|
||||
body_offset = Transform3D(100, 3.05176e-05, -4.19617e-05, -3.8147e-05, 0, -100, -3.8147e-06, 100, 1.14441e-05, 4.57764e-05, 13.8072, -7.62939e-06)
|
||||
mass = 3.0
|
||||
bone_name = "mixamorig_LeftForeArm"
|
||||
@ -1504,11 +1504,11 @@ transform = Transform3D(0.01, 0, 0, 0, -4.37114e-10, 0.01, 0, -0.01, -4.37114e-1
|
||||
shape = SubResource("CapsuleShape3D_2k34c")
|
||||
|
||||
[node name="Physical Bone mixamorig_LeftHand" type="PhysicalBone3D" parent="Body/Armature/Skeleton3D/PhysicalBoneSimulator3D"]
|
||||
transform = Transform3D(9.11563, -98.6768, 13.4089, 23.9481, -10.8976, -96.4766, 96.6612, 12.0056, 22.6379, -10.9684, 56.2242, -106.442)
|
||||
transform = Transform3D(9.11563, -98.6768, 13.4089, 23.9481, -10.8976, -96.4766, 96.6612, 12.0056, 22.6379, -10.9685, 56.2242, -106.442)
|
||||
collision_layer = 4
|
||||
collision_mask = 4
|
||||
joint_type = 1
|
||||
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -8.19564e-08, -9.40636e-08, 0.0264903)
|
||||
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.24797e-07, -1.22003e-07, 0.0264902)
|
||||
body_offset = Transform3D(-58.5197, 57.9894, 56.6805, 1.62125e-05, 69.899, -71.5132, -81.0891, -41.8493, -40.9047, -1.50148, 1.89441, 1.08356)
|
||||
bone_name = "mixamorig_LeftHand"
|
||||
joint_constraints/bias = 0.3
|
||||
@ -1524,7 +1524,7 @@ transform = Transform3D(30.7246, 72.8896, 61.1809, 93.7855, -34.092, -6.48192, 1
|
||||
collision_layer = 4
|
||||
collision_mask = 4
|
||||
joint_type = 1
|
||||
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.63344e-08, 1.16325e-07, 0.137023)
|
||||
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.63344e-08, 1.16326e-07, 0.137023)
|
||||
body_offset = Transform3D(100, -5.72205e-06, 1.19209e-05, 6.67572e-06, 1.07288e-05, -100, -1.90735e-06, 100, 2.64645e-05, 0, 13.7023, -1.52588e-05)
|
||||
mass = 3.0
|
||||
bone_name = "mixamorig_RightArm"
|
||||
@ -1558,7 +1558,7 @@ transform = Transform3D(89.0767, -24.8074, -38.0781, 5.05123, 88.6726, -45.9527,
|
||||
collision_layer = 4
|
||||
collision_mask = 4
|
||||
joint_type = 1
|
||||
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -6.51926e-09, 2.77068e-07, 0.0264903)
|
||||
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.86265e-08, 2.30502e-07, 0.0264903)
|
||||
body_offset = Transform3D(-58.5197, -57.9893, -56.6805, -1.33514e-05, 69.8991, -71.5131, 81.0891, -41.8492, -40.9048, 1.5015, 1.89439, 1.08359)
|
||||
bone_name = "mixamorig_RightHand"
|
||||
joint_constraints/bias = 0.3
|
||||
@ -1591,7 +1591,7 @@ transform = Transform3D(-97.5216, -11.6193, -18.8291, -22.0483, 58.1427, 78.3154
|
||||
collision_layer = 4
|
||||
collision_mask = 4
|
||||
joint_type = 1
|
||||
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -9.03062e-09, -1.30455e-08, 0.210495)
|
||||
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -9.03053e-09, -1.30455e-08, 0.210495)
|
||||
body_offset = Transform3D(100, 4.76837e-06, 1.33514e-05, 5.72205e-06, 0, -100, -9.53674e-07, 100, 1.52588e-05, -1.90735e-06, 21.0495, -1.90735e-06)
|
||||
mass = 5.0
|
||||
bone_name = "mixamorig_LeftLeg"
|
||||
@ -1641,7 +1641,7 @@ transform = Transform3D(-91.8175, -23.5086, -31.8888, -36.0103, 83.0805, 42.437,
|
||||
collision_layer = 4
|
||||
collision_mask = 4
|
||||
joint_type = 1
|
||||
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.48112e-08, -2.68513e-07, 0.210495)
|
||||
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.48112e-08, -2.68514e-07, 0.210495)
|
||||
body_offset = Transform3D(100, -1.71661e-05, 1.33514e-05, -9.53674e-07, 4.19617e-05, -100, 1.90735e-05, 100, 6.86646e-05, -4.29153e-06, 21.0495, 1.23978e-05)
|
||||
mass = 5.0
|
||||
bone_name = "mixamorig_RightLeg"
|
||||
@ -1658,7 +1658,7 @@ transform = Transform3D(-88.192, -17.3351, 43.8367, -46.8549, 42.4444, -77.4796,
|
||||
collision_layer = 4
|
||||
collision_mask = 4
|
||||
joint_type = 1
|
||||
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -5.24152e-08, -2.70387e-09, 0.078608)
|
||||
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -5.24153e-08, -2.70381e-09, 0.078608)
|
||||
body_offset = Transform3D(100, 1.14441e-05, -7.62939e-06, -7.62939e-06, -1.90735e-05, -100, 0, 100, -5.72205e-05, 5.84126e-06, 7.8608, 4.76837e-06)
|
||||
bone_name = "mixamorig_RightFoot"
|
||||
joint_constraints/bias = 0.3
|
||||
|
@ -24,6 +24,8 @@ func _ready() -> void:
|
||||
$Timer.start()
|
||||
if owner_id != multiplayer.get_unique_id():
|
||||
client_node.queue_free()
|
||||
else:
|
||||
client_node._add_legs_to_first_view()
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
@ -67,10 +69,11 @@ func send_position(x: float, y: float, z: float):
|
||||
if multiplayer.is_server():
|
||||
var real_position: Vector3 = server_node.global_position
|
||||
var difference: Vector3 = desired_position - real_position
|
||||
if is_vector_a_lower_than_b(difference, Vector3(0.1, 0.1, 0.1)):
|
||||
if is_vector_a_lower_than_b(difference, Vector3(0.3, 0.3, 0.3)):
|
||||
server_node.global_position = desired_position
|
||||
else:
|
||||
adjust_position.rpc_id(owner_id, real_position.x, real_position.y, real_position.z)
|
||||
var new_position: Vector3 = desired_position.lerp(real_position, 0.5)
|
||||
adjust_position.rpc_id(owner_id, new_position.x, new_position.y, new_position.z)
|
||||
|
||||
@rpc("authority", "call_local")
|
||||
func adjust_position(x: float, y: float, z: float):
|
||||
@ -91,10 +94,11 @@ func send_rotation(x: float, y: float, z: float):
|
||||
if multiplayer.is_server():
|
||||
var real_rotation: Vector3 = server_node.rotation
|
||||
var difference: Vector3 = desired_rotation - real_rotation
|
||||
if is_vector_a_lower_than_b(difference, Vector3(0.1, 0.1, 0.1)):
|
||||
if is_vector_a_lower_than_b(difference, Vector3(0.3, 0.3, 0.3)):
|
||||
server_node.rotation = desired_rotation
|
||||
else:
|
||||
adjust_rotation.rpc_id(owner_id, real_rotation.x, real_rotation.y, real_rotation.z)
|
||||
var new_rotation: Vector3 = desired_rotation.lerp(real_rotation, 0.5)
|
||||
adjust_rotation.rpc_id(owner_id, new_rotation.x, new_rotation.y, new_rotation.z)
|
||||
|
||||
@rpc("any_peer", "call_local")
|
||||
func adjust_rotation(x: float, y: float, z: float):
|
||||
|
@ -1,10 +1,11 @@
|
||||
[gd_scene load_steps=14 format=3 uid="uid://bmm3brgvr4d86"]
|
||||
[gd_scene load_steps=15 format=3 uid="uid://bmm3brgvr4d86"]
|
||||
|
||||
[ext_resource type="Script" path="res://scenes/player/player_input_controller.gd" id="1_m6tul"]
|
||||
[ext_resource type="Script" path="res://scenes/player/placeholder.gd" id="1_ts455"]
|
||||
[ext_resource type="Texture2D" uid="uid://oopj5mj1vdp0" path="res://assets/crosshairs/crosshair_default.png" id="3_8ulsx"]
|
||||
[ext_resource type="Script" path="res://scenes/player/server_player_controller.gd" id="3_f1bhn"]
|
||||
[ext_resource type="PackedScene" uid="uid://dtvo21mk1webd" path="res://scenes/weapon/guns/ak/with_hands.tscn" id="3_xxv4y"]
|
||||
[ext_resource type="PackedScene" uid="uid://1txob6jskn5s" path="res://scenes/characters/blue/dummy.tscn" id="6_e3cnh"]
|
||||
|
||||
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_taqso"]
|
||||
radius = 0.4
|
||||
@ -35,7 +36,7 @@ tracks/0/keys = {
|
||||
[sub_resource type="Animation" id="Animation_mkk0p"]
|
||||
resource_name = "move"
|
||||
length = 0.5
|
||||
loop_mode = 1
|
||||
loop_mode = 2
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
@ -46,7 +47,7 @@ tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.125, 0.25, 0.375, 0.5),
|
||||
"transitions": PackedFloat32Array(1, 2, 1, 2, 1),
|
||||
"update": 0,
|
||||
"values": [Vector3(0, 0, 0), Vector3(0.001, 0.001, -0.001), Vector3(0, 0, 0), Vector3(-0.001, 0.001, -0.001), Vector3(0, 0, 0)]
|
||||
"values": [Vector3(0, 0, 0), Vector3(-0.1, 0.1, -0.1), Vector3(0, 0, 0), Vector3(-0.1, 0.1, -0.1), Vector3(0, 0, 0)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_ah507"]
|
||||
@ -100,7 +101,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.786919, 0)
|
||||
shape = SubResource("CapsuleShape3D_taqso")
|
||||
|
||||
[node name="CameraMount" type="Node3D" parent="PlayerControlledNode"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.29568, -0.128668)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.29568, -0.340905)
|
||||
|
||||
[node name="Camera3D" type="Camera3D" parent="PlayerControlledNode/CameraMount"]
|
||||
cull_mask = 524287
|
||||
@ -171,8 +172,16 @@ render_target_update_mode = 4
|
||||
cull_mask = 524288
|
||||
fov = 40.0
|
||||
|
||||
[node name="WithHands" parent="PlayerControlledNode/CameraMount/Camera3D/HUD/SubViewportContainer/SubViewport/Camera3D" instance=ExtResource("3_xxv4y")]
|
||||
transform = Transform3D(0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 0.423577, -0.565285, -1.76074)
|
||||
[node name="GunMount" type="Node3D" parent="PlayerControlledNode/CameraMount/Camera3D/HUD/SubViewportContainer/SubViewport/Camera3D"]
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="PlayerControlledNode/CameraMount/Camera3D/HUD/SubViewportContainer/SubViewport/Camera3D/GunMount"]
|
||||
active = false
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_u1b6p")
|
||||
}
|
||||
|
||||
[node name="WithHands" parent="PlayerControlledNode/CameraMount/Camera3D/HUD/SubViewportContainer/SubViewport/Camera3D/GunMount" instance=ExtResource("3_xxv4y")]
|
||||
transform = Transform3D(0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 0.51335, -0.655058, -1.67097)
|
||||
visible = false
|
||||
|
||||
[node name="BulletStartingPoint" type="Node3D" parent="PlayerControlledNode/CameraMount"]
|
||||
@ -183,14 +192,6 @@ target_position = Vector3(0, 0, 1000)
|
||||
hit_from_inside = true
|
||||
collide_with_areas = true
|
||||
|
||||
[node name="GunMount" type="Node3D" parent="PlayerControlledNode/CameraMount"]
|
||||
visible = false
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="PlayerControlledNode/CameraMount/GunMount"]
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_u1b6p")
|
||||
}
|
||||
|
||||
[node name="Node3D" type="Node3D" parent="PlayerControlledNode"]
|
||||
|
||||
[node name="ServerControlledNode" type="CharacterBody3D" parent="."]
|
||||
@ -201,6 +202,9 @@ script = ExtResource("3_f1bhn")
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.786919, 0)
|
||||
shape = SubResource("CapsuleShape3D_taqso")
|
||||
|
||||
[node name="Dummy" parent="ServerControlledNode" instance=ExtResource("6_e3cnh")]
|
||||
visible = false
|
||||
|
||||
[node name="MultiplayerSynchronizer" type="MultiplayerSynchronizer" parent="."]
|
||||
replication_config = SubResource("SceneReplicationConfig_7vlrn")
|
||||
|
||||
|
@ -18,8 +18,8 @@ const JUMP_VELOCITY = 4.5
|
||||
|
||||
#func _ready() -> void:
|
||||
var current_gun: String = "ak"
|
||||
@onready var gun_mount: Node3D = $CameraMount/GunMount
|
||||
@onready var gun_mount_anim: AnimationPlayer = $CameraMount/GunMount/AnimationPlayer
|
||||
@onready var gun_mount: Node3D = $CameraMount/Camera3D/HUD/SubViewportContainer/SubViewport/Camera3D/GunMount
|
||||
@onready var gun_mount_anim: AnimationPlayer = $CameraMount/Camera3D/HUD/SubViewportContainer/SubViewport/Camera3D/GunMount/AnimationPlayer
|
||||
var gun_with_hands: Node3D = null
|
||||
@onready var bullet_starting_point: Node3D = $CameraMount/BulletStartingPoint
|
||||
@onready var aim_ray: RayCast3D = $CameraMount/BulletStartingPoint/AimRay
|
||||
@ -42,7 +42,7 @@ func _ready() -> void:
|
||||
current_weapon_cooldown_interwal = node.cooldown
|
||||
current_weapon_damage = node.damage
|
||||
gun_with_hands = node
|
||||
gun_camera.add_child(node)
|
||||
gun_mount.add_child(node)
|
||||
|
||||
func _input(event):
|
||||
if multiplayer.get_unique_id() == get_multiplayer_authority():
|
||||
@ -61,12 +61,29 @@ func _process(delta: float) -> void:
|
||||
if multiplayer.get_unique_id() == get_multiplayer_authority():
|
||||
if !paused:
|
||||
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
|
||||
server_node.set_input_direction.rpc_id(1, input_direction)
|
||||
input_direction = Input.get_vector("move_left", "move_right", "move_forward", "move_backwards")
|
||||
server_node.set_input_direction.rpc_id(1, input_direction)
|
||||
if Input.is_action_just_pressed("jump"):
|
||||
server_node.jump.rpc_id(1)
|
||||
jump.rpc_id(1)
|
||||
if Input.is_action_pressed("shot"): _shoot()
|
||||
if multiplayer.get_unique_id() == get_multiplayer_authority():
|
||||
if not is_on_floor():
|
||||
velocity += get_gravity() * delta
|
||||
if is_on_floor() && jumping:
|
||||
velocity.y = JUMP_VELOCITY
|
||||
jumping = false
|
||||
var direction := (transform.basis * Vector3(input_direction.x, 0, input_direction.y)).normalized()
|
||||
if is_on_floor():
|
||||
if direction:
|
||||
first_view_legs_anim.play("Run Forward")
|
||||
gun_mount_anim.play("move")
|
||||
velocity.x = direction.x * placeholder.character_speed
|
||||
velocity.z = direction.z * placeholder.character_speed
|
||||
else:
|
||||
velocity.x = move_toward(velocity.x, 0, placeholder.character_speed)
|
||||
velocity.z = move_toward(velocity.z, 0, placeholder.character_speed)
|
||||
move_and_slide()
|
||||
|
||||
|
||||
var cant_shoot: bool = false
|
||||
func _shoot():
|
||||
@ -75,22 +92,42 @@ func _shoot():
|
||||
cant_shoot = true
|
||||
await get_tree().create_timer(current_weapon_cooldown_interwal).timeout
|
||||
cant_shoot = false
|
||||
func _physics_process(delta: float) -> void:
|
||||
if not is_on_floor():
|
||||
velocity += get_gravity() * delta
|
||||
if is_on_floor() && jumping:
|
||||
velocity.y = JUMP_VELOCITY
|
||||
jumping = false
|
||||
if multiplayer.get_unique_id() == get_multiplayer_authority():
|
||||
var direction := (transform.basis * Vector3(input_direction.x, 0, input_direction.y)).normalized()
|
||||
if is_on_floor():
|
||||
if direction:
|
||||
velocity.x = direction.x * placeholder.character_speed
|
||||
velocity.z = direction.z * placeholder.character_speed
|
||||
else:
|
||||
velocity.x = move_toward(velocity.x, 0, placeholder.character_speed)
|
||||
velocity.z = move_toward(velocity.z, 0, placeholder.character_speed)
|
||||
move_and_slide()
|
||||
|
||||
#func _physics_process(delta: float) -> void:
|
||||
#if multiplayer.get_unique_id() == get_multiplayer_authority():
|
||||
#if not is_on_floor():
|
||||
#velocity += get_gravity() * delta
|
||||
#if is_on_floor() && jumping:
|
||||
#velocity.y = JUMP_VELOCITY
|
||||
#jumping = false
|
||||
#var direction := (transform.basis * Vector3(input_direction.x, 0, input_direction.y)).normalized()
|
||||
#if is_on_floor():
|
||||
#if direction:
|
||||
#velocity.x = direction.x * placeholder.character_speed
|
||||
#velocity.z = direction.z * placeholder.character_speed
|
||||
#else:
|
||||
#velocity.x = move_toward(velocity.x, 0, placeholder.character_speed)
|
||||
#velocity.z = move_toward(velocity.z, 0, placeholder.character_speed)
|
||||
#move_and_slide()
|
||||
var first_view_legs_anim: AnimationPlayer = null
|
||||
func _add_legs_to_first_view() -> Error :
|
||||
# -- TODO: It should not be hardcoded
|
||||
var path := "res://scenes/characters/blue/dummy.tscn"
|
||||
if not ResourceLoader.exists(path):
|
||||
return ERR_DOES_NOT_EXIST
|
||||
var scene: PackedScene = ResourceLoader.load(path)
|
||||
if not scene.can_instantiate():
|
||||
return ERR_CANT_OPEN
|
||||
var node: Node3D = scene.instantiate()
|
||||
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))
|
||||
add_child(node)
|
||||
var animation_node: AnimationPlayer = node.find_child("AnimationPlayer")
|
||||
if animation_node != null:
|
||||
first_view_legs_anim = animation_node
|
||||
return OK
|
||||
|
||||
var camera_sens: float = 0.002
|
||||
|
||||
|
@ -32,13 +32,13 @@ func _physics_process(delta: float) -> void:
|
||||
if is_on_floor() && jumping:
|
||||
velocity.y = JUMP_VELOCITY
|
||||
jumping = false
|
||||
|
||||
var direction := (transform.basis * Vector3(input_direction.x, 0, input_direction.y)).normalized()
|
||||
#if is_on_floor():
|
||||
if direction:
|
||||
velocity.x = direction.x * placeholder.character_speed
|
||||
velocity.z = direction.z * placeholder.character_speed
|
||||
else:
|
||||
velocity.x = move_toward(velocity.x, 0, placeholder.character_speed)
|
||||
velocity.z = move_toward(velocity.z, 0, placeholder.character_speed)
|
||||
if is_on_floor():
|
||||
var direction := (transform.basis * Vector3(input_direction.x, 0, input_direction.y)).normalized()
|
||||
#if is_on_floor():
|
||||
if direction:
|
||||
velocity.x = direction.x * placeholder.character_speed
|
||||
velocity.z = direction.z * placeholder.character_speed
|
||||
else:
|
||||
velocity.x = move_toward(velocity.x, 0, placeholder.character_speed)
|
||||
velocity.z = move_toward(velocity.z, 0, placeholder.character_speed)
|
||||
move_and_slide()
|
||||
|
Loading…
x
Reference in New Issue
Block a user