WIP: Better player input system
This commit is contained in:
@ -15,8 +15,6 @@ func _process(delta: float) -> void:
|
||||
|
||||
|
||||
func _on_head_collision_body_part_hit(dam: Variant) -> void:
|
||||
#print("head is hit" + str(dam))
|
||||
#print(owner_placeholder)
|
||||
#if owner_placeholder.has_method("take_damage"):
|
||||
if owner_placeholder:
|
||||
owner_placeholder.take_damage(dam)
|
||||
|
@ -1419,12 +1419,12 @@ 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.290624, -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, -8.35312e-08, -5.58794e-09, 0.0499956)
|
||||
body_offset = Transform3D(100, -0.0695305, -0.00860751, -1.19209e-05, 12.2744, -99.2438, 0.0700493, 99.2438, 12.2744, 0.00043869, 4.96175, -0.613665)
|
||||
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -9.28935e-08, -8.84756e-09, 0.0499956)
|
||||
body_offset = Transform3D(100, -0.0695305, -0.00860786, -1.28746e-05, 12.2744, -99.2438, 0.0700493, 99.2438, 12.2744, 0.000439644, 4.96175, -0.613665)
|
||||
mass = 20.0
|
||||
bone_name = "mixamorig_Hips"
|
||||
joint_constraints/bias = 0.3
|
||||
@ -1436,12 +1436,12 @@ transform = Transform3D(0.01, 0, 0, 0, -4.37114e-10, 0.01, 0, -0.01, -4.37114e-1
|
||||
shape = SubResource("CapsuleShape3D_0ptuo")
|
||||
|
||||
[node name="Physical Bone mixamorig_Spine" type="PhysicalBone3D" parent="Body/Armature/Skeleton3D/PhysicalBoneSimulator3D"]
|
||||
transform = Transform3D(80.9412, -58.546, -4.56913, 57.6046, 80.6695, -13.1964, 11.4119, 8.0493, 99.0201, 2.40599, 0.973749, -98.2036)
|
||||
transform = Transform3D(80.9412, -58.5461, -4.56913, 57.6046, 80.6695, -13.1964, 11.4119, 8.04929, 99.0201, 2.40599, 0.973749, -98.2036)
|
||||
collision_layer = 4
|
||||
collision_mask = 4
|
||||
joint_type = 1
|
||||
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 4.2222e-09, 2.2377e-09, 0.05866)
|
||||
body_offset = Transform3D(100, 7.62939e-06, 9.05991e-06, 4.76837e-06, -1.90735e-06, -100, -1.52588e-05, 100, -3.8147e-06, -9.53674e-07, 5.866, 0)
|
||||
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 3.66277e-09, 1.11885e-09, 0.0586601)
|
||||
body_offset = Transform3D(100, 1.52588e-05, 1.00136e-05, 4.76837e-06, 0, -100, -1.52588e-05, 100, -1.90735e-06, -9.53674e-07, 5.866, 0)
|
||||
mass = 20.0
|
||||
bone_name = "mixamorig_Spine"
|
||||
joint_constraints/bias = 0.3
|
||||
@ -1453,12 +1453,12 @@ 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.47329, 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.4733, 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, -3.90306e-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, 7.24792e-05, 9.23741, 3.31821)
|
||||
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -5.81038e-08, -1.37836e-07, 0.0981531)
|
||||
body_offset = Transform3D(-100, -0.00220108, -0.000778198, -5.24521e-06, 33.8066, -94.1122, 0.00232792, -94.1122, -33.8066, 7.05719e-05, 9.23741, 3.31821)
|
||||
mass = 7.0
|
||||
bone_name = "mixamorig_Head"
|
||||
joint_constraints/bias = 0.3
|
||||
@ -1474,8 +1474,8 @@ transform = Transform3D(86.1165, 14.0252, -48.8594, -45.4995, 64.1262, -61.787,
|
||||
collision_layer = 4
|
||||
collision_mask = 4
|
||||
joint_type = 1
|
||||
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 3.65892e-08, 2.39336e-07, 0.137023)
|
||||
body_offset = Transform3D(100, -3.05176e-05, -2.67029e-05, 2.09808e-05, 100, -7.62939e-06, 1.71661e-05, -3.8147e-06, 100, 0, -2.28882e-05, -13.7023)
|
||||
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.55782e-09, 2.39336e-07, 0.137023)
|
||||
body_offset = Transform3D(100, -3.43323e-05, -2.67029e-05, 2.47955e-05, 100, -7.62939e-06, 1.71661e-05, -3.8147e-06, 100, 3.8147e-06, -2.28882e-05, -13.7023)
|
||||
mass = 3.0
|
||||
bone_name = "mixamorig_LeftArm"
|
||||
joint_constraints/bias = 0.3
|
||||
@ -1491,8 +1491,8 @@ 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, -2.47239e-07, 6.31263e-08, 0.138072)
|
||||
body_offset = Transform3D(100, 3.05176e-05, -4.19617e-05, -3.8147e-05, 0, -100, -3.8147e-06, 100, 9.53674e-06, 3.05176e-05, 13.8072, -7.62939e-06)
|
||||
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -3.28799e-07, 6.04928e-08, 0.138072)
|
||||
body_offset = Transform3D(100, 3.05176e-05, -3.8147e-05, -3.8147e-05, 0, -100, -3.8147e-06, 100, 1.14441e-05, 3.8147e-05, 13.8072, -7.62939e-06)
|
||||
mass = 3.0
|
||||
bone_name = "mixamorig_LeftForeArm"
|
||||
joint_constraints/bias = 0.3
|
||||
@ -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.9685, 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.9684, 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, -1.24797e-07, -1.22003e-07, 0.0264902)
|
||||
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -8.19564e-08, -9.40636e-08, 0.0264903)
|
||||
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.16326e-07, 0.137023)
|
||||
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.63344e-08, 1.16325e-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"
|
||||
@ -1541,8 +1541,8 @@ transform = Transform3D(24.3552, 37.4063, 89.4852, -25.0101, 91.5653, -31.4688,
|
||||
collision_layer = 4
|
||||
collision_mask = 4
|
||||
joint_type = 1
|
||||
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.40737e-07, -2.80688e-08, 0.138072)
|
||||
body_offset = Transform3D(100, -1.14441e-05, 8.58307e-06, -3.8147e-06, 100, 9.53674e-06, 5.72205e-06, -5.72205e-06, 100, -1.52588e-05, 1.49012e-06, -13.8072)
|
||||
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.40737e-07, -4.23738e-08, 0.138072)
|
||||
body_offset = Transform3D(100, -1.14441e-05, 8.58307e-06, -3.8147e-06, 100, 9.53674e-06, 5.72205e-06, -5.72205e-06, 100, -1.52588e-05, 2.92063e-06, -13.8072)
|
||||
mass = 3.0
|
||||
bone_name = "mixamorig_RightForeArm"
|
||||
joint_constraints/bias = 0.3
|
||||
@ -1558,8 +1558,8 @@ 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, 1.86265e-08, 2.31434e-07, 0.0264903)
|
||||
body_offset = Transform3D(-58.5197, -57.9893, -56.6805, -1.19209e-05, 69.8991, -71.5131, 81.0891, -41.8492, -40.9048, 1.5015, 1.89439, 1.08359)
|
||||
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -6.51926e-09, 2.77068e-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
|
||||
joint_constraints/damping = 1.0
|
||||
@ -1574,8 +1574,8 @@ transform = Transform3D(-96.1774, -26.2683, 7.73901, -23.4203, 64.2554, -72.957,
|
||||
collision_layer = 4
|
||||
collision_mask = 4
|
||||
joint_type = 1
|
||||
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 3.78612e-08, -7.74374e-09, 0.202997)
|
||||
body_offset = Transform3D(100, -2.86102e-05, 9.53674e-06, 7.62939e-06, 7.62939e-06, -100, 3.71933e-05, 100, 3.8147e-06, -5.72205e-06, 20.2997, 0)
|
||||
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 3.39893e-08, -7.74373e-09, 0.202997)
|
||||
body_offset = Transform3D(100, -3.8147e-05, 1.14441e-05, 7.62939e-06, 7.62939e-06, -100, 4.19617e-05, 100, 3.8147e-06, -5.72205e-06, 20.2997, 0)
|
||||
mass = 5.0
|
||||
bone_name = "mixamorig_LeftUpLeg"
|
||||
joint_constraints/bias = 0.3
|
||||
@ -1591,8 +1591,8 @@ 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.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)
|
||||
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -5.01575e-09, -2.10752e-08, 0.210495)
|
||||
body_offset = Transform3D(100, 4.76837e-06, 1.14441e-05, 5.72205e-06, 0, -100, -9.53674e-07, 100, 1.90735e-05, -1.90735e-06, 21.0495, -1.90735e-06)
|
||||
mass = 5.0
|
||||
bone_name = "mixamorig_LeftLeg"
|
||||
joint_constraints/bias = 0.3
|
||||
@ -1604,12 +1604,12 @@ transform = Transform3D(0.01, 0, 0, 0, -4.37114e-10, 0.01, 0, -0.01, -4.37114e-1
|
||||
shape = SubResource("CapsuleShape3D_vwdij")
|
||||
|
||||
[node name="Physical Bone mixamorig_LeftFoot" type="PhysicalBone3D" parent="Body/Armature/Skeleton3D/PhysicalBoneSimulator3D"]
|
||||
transform = Transform3D(-93.6712, -34.5296, 5.78095, -34.9451, 91.207, -21.4506, 2.13418, -22.1132, -97.501, 11.7385, 3.12728, -14.5678)
|
||||
transform = Transform3D(-93.6712, -34.5296, 5.78095, -34.9451, 91.207, -21.4506, 2.13419, -22.1132, -97.501, 11.7385, 3.12728, -14.5678)
|
||||
collision_layer = 4
|
||||
collision_mask = 4
|
||||
joint_type = 1
|
||||
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -7.66258e-09, 5.6483e-08, 0.078608)
|
||||
body_offset = Transform3D(100, 5.72205e-06, -2.38419e-06, -2.86102e-06, -1.52588e-05, -100, -5.72205e-06, 100, -3.24249e-05, 9.53674e-07, 7.8608, -3.09944e-06)
|
||||
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -8.41225e-09, 6.36356e-08, 0.078608)
|
||||
body_offset = Transform3D(100, 5.72205e-06, -1.43051e-06, -1.90735e-06, -1.52588e-05, -100, -5.72205e-06, 100, -3.24249e-05, 9.53674e-07, 7.8608, -3.8147e-06)
|
||||
bone_name = "mixamorig_LeftFoot"
|
||||
joint_constraints/bias = 0.3
|
||||
joint_constraints/damping = 1.0
|
||||
@ -1624,8 +1624,8 @@ transform = Transform3D(-83.6898, -51.5224, 18.4786, -50.5592, 59.8312, -62.161,
|
||||
collision_layer = 4
|
||||
collision_mask = 4
|
||||
joint_type = 1
|
||||
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.31228e-08, 7.74372e-09, 0.202997)
|
||||
body_offset = Transform3D(100, -1.52588e-05, 7.62939e-06, 5.72205e-06, -3.8147e-06, -100, 1.14441e-05, 100, -3.8147e-06, -2.86102e-06, 20.2997, 0)
|
||||
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2.08665e-08, 7.74372e-09, 0.202997)
|
||||
body_offset = Transform3D(100, -1.52588e-05, 3.8147e-06, 5.72205e-06, -3.8147e-06, -100, 1.14441e-05, 100, -3.8147e-06, -2.86102e-06, 20.2997, 0)
|
||||
mass = 5.0
|
||||
bone_name = "mixamorig_RightUpLeg"
|
||||
joint_constraints/bias = 0.3
|
||||
@ -1641,8 +1641,8 @@ 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, 5.27453e-09, -2.4944e-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, -3.33786e-06, 21.0495, 1.04904e-05)
|
||||
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.40577e-08, -2.67006e-07, 0.210495)
|
||||
body_offset = Transform3D(100, -1.71661e-05, 1.14441e-05, -9.53674e-07, 4.19617e-05, -100, 1.90735e-05, 100, 7.24792e-05, -3.8147e-06, 21.0495, 1.14441e-05)
|
||||
mass = 5.0
|
||||
bone_name = "mixamorig_RightLeg"
|
||||
joint_constraints/bias = 0.3
|
||||
@ -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.24153e-08, -2.70381e-09, 0.078608)
|
||||
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -5.24152e-08, -2.70387e-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
|
||||
|
@ -1,7 +1,8 @@
|
||||
[gd_scene load_steps=11 format=3 uid="uid://b10lpwfjgxds4"]
|
||||
[gd_scene load_steps=13 format=3 uid="uid://b10lpwfjgxds4"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/player/player_input_controller.gd" id="1_q75ai"]
|
||||
[ext_resource type="Texture2D" uid="uid://oopj5mj1vdp0" path="res://assets/crosshairs/crosshair_default.png" id="2_lsd7c"]
|
||||
[ext_resource type="Script" path="res://scenes/characters/player_input_controller.gd" id="3_n3epd"]
|
||||
|
||||
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_jc50w"]
|
||||
margin = 0.5
|
||||
@ -18,6 +19,12 @@ properties/1/replication_mode = 1
|
||||
properties/2/path = NodePath(".:health")
|
||||
properties/2/spawn = true
|
||||
properties/2/replication_mode = 2
|
||||
properties/3/path = NodePath(".:velocity")
|
||||
properties/3/spawn = true
|
||||
properties/3/replication_mode = 1
|
||||
properties/4/path = NodePath(".:owner_id")
|
||||
properties/4/spawn = true
|
||||
properties/4/replication_mode = 1
|
||||
|
||||
[sub_resource type="Animation" id="Animation_falg4"]
|
||||
length = 0.001
|
||||
@ -83,11 +90,23 @@ font_size = 70
|
||||
font_size = 100
|
||||
font_color = Color(0.756874, 0, 0.223924, 1)
|
||||
|
||||
[sub_resource type="SceneReplicationConfig" id="SceneReplicationConfig_eour5"]
|
||||
properties/0/path = NodePath(".:input_direction")
|
||||
properties/0/spawn = false
|
||||
properties/0/replication_mode = 2
|
||||
properties/1/path = NodePath(".:jumping")
|
||||
properties/1/spawn = false
|
||||
properties/1/replication_mode = 2
|
||||
|
||||
[node name="CharacterPlaceholder" type="CharacterBody3D"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.799455, 0)
|
||||
collision_layer = 9
|
||||
collision_mask = 9
|
||||
script = ExtResource("1_q75ai")
|
||||
health = null
|
||||
owner_id = null
|
||||
jump_height = null
|
||||
camera_sens = null
|
||||
|
||||
[node name="Collision" type="CollisionShape3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.0150437, 0)
|
||||
@ -163,3 +182,8 @@ label_settings = SubResource("LabelSettings_1j1uq")
|
||||
|
||||
[node name="ModelMount" type="Node3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.790262, 0)
|
||||
|
||||
[node name="PlayerInput" type="MultiplayerSynchronizer" parent="."]
|
||||
root_path = NodePath(".")
|
||||
replication_config = SubResource("SceneReplicationConfig_eour5")
|
||||
script = ExtResource("3_n3epd")
|
||||
|
35
scenes/characters/player_input_controller.gd
Normal file
35
scenes/characters/player_input_controller.gd
Normal file
@ -0,0 +1,35 @@
|
||||
extends MultiplayerSynchronizer
|
||||
|
||||
@export var jumping := false
|
||||
@export var input_direction := Vector2()
|
||||
|
||||
@onready var camera_mount = $"../FirstPersonCameraMount"
|
||||
@onready var placeholder = $".."
|
||||
|
||||
func _ready() -> void:
|
||||
pass
|
||||
#set_process(get_multiplayer_authority() == multiplayer.get_unique_id())
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
# Add the gravity.
|
||||
if multiplayer.get_unique_id() == get_multiplayer_authority():
|
||||
input_direction = Input.get_vector("move_left", "move_right", "move_forward", "move_backwards")
|
||||
set_input_direction.rpc(input_direction)
|
||||
if Input.is_action_just_pressed("jump"):
|
||||
jump.rpc_id(1)
|
||||
|
||||
var camera_sens: float = 0.002
|
||||
func _input(event):
|
||||
if multiplayer.get_unique_id() == get_multiplayer_authority():
|
||||
if event is InputEventMouseMotion and Input.mouse_mode == Input.MOUSE_MODE_CAPTURED:
|
||||
placeholder.rotate_y(-event.relative.x * camera_sens)
|
||||
|
||||
|
||||
@rpc("any_peer", "call_local", "reliable")
|
||||
func set_input_direction(direction: Vector2):
|
||||
input_direction = direction
|
||||
|
||||
@rpc("any_peer", "call_local", "reliable")
|
||||
func jump():
|
||||
jumping = true
|
Reference in New Issue
Block a user