Compare commits

14 Commits

Author SHA1 Message Date
89b62317d4 brodacast shoot 2024-08-27 16:21:42 +02:00
2353cbb2be make factories 2024-08-27 15:42:23 +02:00
3c6a3dba44 refactor player 2024-08-27 15:29:45 +02:00
0d72e7f765 set bullet transform 2024-08-27 15:01:32 +02:00
60d0a83345 bullet: remove transparency 2024-08-27 15:01:14 +02:00
e5436241ef attach pencil case to right arm 2024-08-26 12:23:40 +02:00
b64a372af8 add bullet decay 2024-08-25 12:20:20 +02:00
9df52e0016 stick pens on walls 2024-08-25 12:03:52 +02:00
8d12eff214 shooting pens (locally) 2024-08-24 18:32:24 +02:00
b28fdc0a94 la trousse 2024-08-24 18:13:53 +02:00
137559ad29 scene: remove uids 2024-08-24 16:05:22 +02:00
39b9e6039c set firstperson model invisible 2024-08-24 16:00:16 +02:00
da8232f62b fixed jump 2024-08-24 15:54:23 +02:00
ed771ad861 upload ressources and remove old player 2024-08-24 15:18:07 +02:00
34 changed files with 1451 additions and 7650 deletions

1
.gitattributes vendored
View File

@@ -2,3 +2,4 @@
*.png filter=lfs diff=lfs merge=lfs -text
*.fbx filter=lfs diff=lfs merge=lfs -text
*.glb filter=lfs diff=lfs merge=lfs -text
*.res filter=lfs diff=lfs merge=lfs -text

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@@ -0,0 +1,224 @@
[gd_scene load_steps=4 format=3 uid="uid://cwbg6ekri5onf"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_4xaty"]
albedo_color = Color(0, 0.4, 1, 1)
[sub_resource type="CylinderMesh" id="CylinderMesh_iro55"]
material = SubResource("StandardMaterial3D_4xaty")
top_radius = 0.05
bottom_radius = 0.05
height = 0.2
[sub_resource type="Skin" id="Skin_cysku"]
resource_name = "Skin"
bind_count = 67
bind/0/name = &"mixamorig_Hips"
bind/0/bone = -1
bind/0/pose = Transform3D(100, 0, 0, 0, 100, 4.37114e-06, 0, -4.37114e-06, 100, 0.0419201, -209.151, 1.41641)
bind/1/name = &"mixamorig_Spine"
bind/1/bone = -1
bind/1/pose = Transform3D(99.9934, 1.15074, 4.26326e-08, -1.14498, 99.4929, -9.99272, -0.11499, 9.99206, 99.4995, -2.39798, -228.327, -17.5981)
bind/2/name = &"mixamorig_Spine1"
bind/2/bone = -1
bind/2/pose = Transform3D(99.9992, 0.392417, 6.03961e-08, -0.392055, 99.907, -4.29468, -0.0168531, 4.29465, 99.9077, -0.483516, -252.552, -3.18282)
bind/3/name = &"mixamorig_Spine2"
bind/3/bone = -1
bind/3/pose = Transform3D(99.983, -1.84448, 5.68434e-08, 1.83111, 99.258, 12.0204, -0.221714, -12.0184, 99.2749, 5.78559, -277.107, 42.4792)
bind/4/name = &"mixamorig_Neck"
bind/4/bone = -1
bind/4/pose = Transform3D(99.8904, -4.68136, 0, 4.49289, 95.8689, 28.0886, -1.31493, -28.0578, 95.9741, 14.6175, -297.03, 92.2453)
bind/5/name = &"mixamorig_Head"
bind/5/bone = -1
bind/5/pose = Transform3D(99.8904, -4.68136, 1.13687e-07, 4.49289, 95.8689, 28.0886, -1.31493, -28.0578, 95.9741, 14.6175, -320.219, 92.2453)
bind/6/name = &"mixamorig_HeadTop_End"
bind/6/bone = -1
bind/6/pose = Transform3D(99.8904, -4.68135, 4.54747e-07, 4.49289, 95.8689, 28.0886, -1.31493, -28.0578, 95.9741, 16.2573, -359.996, 92.6064)
bind/7/name = &"mixamorig_RightEye"
bind/7/bone = -1
bind/7/pose = Transform3D(99.8904, -4.68136, 1.13687e-07, 4.49289, 95.8689, 28.0886, -1.31493, -28.0578, 95.9741, 21.4989, -340.362, 80.9932)
bind/8/name = &"mixamorig_LeftEye"
bind/8/bone = -1
bind/8/pose = Transform3D(99.8904, -4.68135, 6.82121e-07, 4.49289, 95.8689, 28.0886, -1.31493, -28.0578, 95.9741, 9.3221, -341.245, 80.9355)
bind/9/name = &"mixamorig_LeftShoulder"
bind/9/bone = -1
bind/9/pose = Transform3D(-15.2443, -0.449328, -98.8302, 98.7873, 2.9119, -15.2509, 2.94636, -99.9566, -1.79057e-05, -2.88629, -21.8424, 298.665)
bind/10/name = &"mixamorig_LeftArm"
bind/10/bone = -1
bind/10/pose = Transform3D(4.12623e-05, 2.54824e-06, -100, 100, -5.83008e-05, 4.52544e-05, -5.51343e-05, -100, -4.91009e-07, -10.2379, -38.5985, 299.932)
bind/11/name = &"mixamorig_LeftForeArm"
bind/11/bone = -1
bind/11/pose = Transform3D(4.33707e-05, 4.42927e-06, -100, 100, -6.09941e-05, 4.73628e-05, -5.78276e-05, -100, -2.37204e-06, -10.2379, -93.7262, 299.932)
bind/12/name = &"mixamorig_LeftHand"
bind/12/bone = -1
bind/12/pose = Transform3D(3.5985e-05, -2.95641e-06, -100, 100, -3.16651e-06, 3.99771e-05, 2.30722e-12, -100, 5.01367e-06, -10.2379, -146.5, 299.932)
bind/13/name = &"mixamorig_LeftHandMiddle1"
bind/13/bone = -1
bind/13/pose = Transform3D(4.1275e-05, 2.33357e-06, -100, 100, -3.16651e-06, 4.52671e-05, 4.49066e-12, -100, -2.76313e-07, -10.2379, -174.244, 299.932)
bind/14/name = &"mixamorig_LeftHandMiddle2"
bind/14/bone = -1
bind/14/pose = Transform3D(4.19282e-05, 2.98677e-06, -100, 100, -0.000450401, 4.59203e-05, -0.000447234, -100, -9.29715e-07, -10.2379, -181.175, 299.933)
bind/15/name = &"mixamorig_LeftHandMiddle3"
bind/15/bone = -1
bind/15/pose = Transform3D(3.87006e-05, -2.4079e-07, -100, 100, -3.1665e-06, 4.26927e-05, -2.58102e-12, -100, 2.29805e-06, -10.2379, -188, 299.932)
bind/16/name = &"mixamorig_LeftHandMiddle4"
bind/16/bone = -1
bind/16/pose = Transform3D(3.87007e-05, -2.4079e-07, -100, 100, -3.1665e-06, 4.26928e-05, -2.58102e-12, -100, 2.29805e-06, -10.238, -195.392, 299.932)
bind/17/name = &"mixamorig_LeftHandThumb1"
bind/17/bone = -1
bind/17/pose = Transform3D(38.73, -22.3607, -89.4426, 77.4596, -44.7213, 44.7215, -49.9999, -86.6026, -5.63887e-05, 1.60829, 12.405, 335.71)
bind/18/name = &"mixamorig_LeftHandThumb2"
bind/18/bone = -1
bind/18/pose = Transform3D(38.7299, -22.3607, -89.4427, 77.4597, -44.7213, 44.7215, -50, -86.6026, 3.09228e-05, 1.60861, 1.18065, 335.71)
bind/19/name = &"mixamorig_LeftHandThumb3"
bind/19/bone = -1
bind/19/pose = Transform3D(38.7299, -22.3608, -89.4427, 77.4597, -44.7212, 44.7215, -49.9999, -86.6026, 0.000112777, 1.60875, -7.77524, 335.71)
bind/20/name = &"mixamorig_LeftHandThumb4"
bind/20/bone = -1
bind/20/pose = Transform3D(38.7299, -22.3608, -89.4427, 77.4597, -44.7212, 44.7215, -49.9999, -86.6026, 9.09495e-05, 1.60865, -13.5698, 335.71)
bind/21/name = &"mixamorig_LeftHandIndex1"
bind/21/bone = -1
bind/21/pose = Transform3D(4.27364e-05, 1.56652e-06, -100, 100, -3.16651e-06, 4.67285e-05, 4.24015e-12, -100, 4.90744e-07, -5.08588, -174.99, 299.478)
bind/22/name = &"mixamorig_LeftHandIndex2"
bind/22/bone = -1
bind/22/pose = Transform3D(4.40478e-05, 5.10635e-06, -100, 100, -3.16651e-06, 4.80399e-05, 5.79937e-12, -100, -3.04909e-06, -5.0859, -182.053, 299.478)
bind/23/name = &"mixamorig_LeftHandIndex3"
bind/23/bone = -1
bind/23/pose = Transform3D(4.33923e-05, 4.4509e-06, -100, 100, -3.16651e-06, 4.73844e-05, 5.51495e-12, -100, -2.39364e-06, -5.08587, -188.548, 299.478)
bind/24/name = &"mixamorig_LeftHandIndex4"
bind/24/bone = -1
bind/24/pose = Transform3D(4.33923e-05, 4.4509e-06, -100, 100, -3.16651e-06, 4.73844e-05, 5.51495e-12, -100, -2.39364e-06, -5.08584, -195.142, 299.478)
bind/25/name = &"mixamorig_LeftHandRing1"
bind/25/bone = -1
bind/25/pose = Transform3D(4.35421e-05, 6.40099e-06, -100, 100, -3.16651e-06, 4.75342e-05, 6.38163e-12, -100, -4.34373e-06, -14.479, -171.984, 300.012)
bind/26/name = &"mixamorig_LeftHandRing2"
bind/26/bone = -1
bind/26/pose = Transform3D(4.49878e-05, 6.04632e-06, -100, 100, -3.16651e-06, 4.89799e-05, 6.22207e-12, -100, -3.98906e-06, -14.4789, -178.294, 300.012)
bind/27/name = &"mixamorig_LeftHandRing3"
bind/27/bone = -1
bind/27/pose = Transform3D(-0.000108406, -0.000147347, -100, 100, -3.1665e-06, -0.000104414, 1.66702e-10, -100, 0.000149405, -14.4782, -184.653, 300.012)
bind/28/name = &"mixamorig_LeftHandRing4"
bind/28/bone = -1
bind/28/pose = Transform3D(4.06522e-05, 1.71072e-06, -100, 100, -3.16659e-06, 4.46443e-05, -8.28545e-11, -100, 3.46547e-07, -14.4789, -191.691, 300.011)
bind/29/name = &"mixamorig_LeftHandPinky1"
bind/29/bone = -1
bind/29/pose = Transform3D(2.13955e-05, -9.76242e-06, -100, 100, -3.16651e-06, 2.53876e-05, 8.51037e-13, -100, 1.18197e-05, -19.0188, -168.406, 299.491)
bind/30/name = &"mixamorig_LeftHandPinky2"
bind/30/bone = -1
bind/30/pose = Transform3D(0.000229854, 0.000190912, -100, 100, -0.000738696, 0.000233845, -0.000735529, -100, -0.000188856, -19.0198, -174.94, 299.493)
bind/31/name = &"mixamorig_LeftHandPinky3"
bind/31/bone = -1
bind/31/pose = Transform3D(3.4283e-05, -4.65839e-06, -100, 100, -3.16654e-06, 3.82751e-05, -3.8009e-12, -100, 6.71569e-06, -19.0188, -179.091, 299.491)
bind/32/name = &"mixamorig_LeftHandPinky4"
bind/32/bone = -1
bind/32/pose = Transform3D(3.4283e-05, -4.65842e-06, -100, 100, -3.16654e-06, 3.82751e-05, -3.80091e-12, -100, 6.71572e-06, -19.0188, -184.655, 299.491)
bind/33/name = &"mixamorig_RightShoulder"
bind/33/bone = -1
bind/33/pose = Transform3D(-20.1629, 0.35292, 97.9456, -97.9306, 1.71404, -20.166, -1.74999, -99.9847, 1.80194e-05, 2.8144, -19.4598, 299.201)
bind/34/name = &"mixamorig_RightArm"
bind/34/bone = -1
bind/34/pose = Transform3D(8.68049e-05, -1.24537e-05, 100, -100, -1.86276e-07, 8.8915e-05, -3.72535e-07, -100, -1.15962e-05, 12.104, -39.589, 299.94)
bind/35/name = &"mixamorig_RightForeArm"
bind/35/bone = -1
bind/35/pose = Transform3D(7.96092e-05, -4.90495e-06, 100, -100, -5.58804e-07, 8.17193e-05, 2.57644e-13, -100, -4.0475e-06, 12.104, -95.4317, 299.94)
bind/36/name = &"mixamorig_RightHand"
bind/36/bone = -1
bind/36/pose = Transform3D(8.07296e-05, -6.02537e-06, 100, -100, -5.58804e-07, 8.28397e-05, -6.43239e-13, -100, -5.16792e-06, 12.1041, -145.745, 299.94)
bind/37/name = &"mixamorig_RightHandMiddle1"
bind/37/bone = -1
bind/37/pose = Transform3D(7.74089e-05, -2.70475e-06, 100, -100, -5.58804e-07, 7.95191e-05, 1.92722e-12, -100, -1.8473e-06, 12.1041, -171.811, 299.94)
bind/38/name = &"mixamorig_RightHandMiddle2"
bind/38/bone = -1
bind/38/pose = Transform3D(7.86091e-05, -3.90488e-06, 100, -100, -5.58804e-07, 8.07192e-05, 1.04055e-12, -100, -3.04743e-06, 12.1041, -177.971, 299.94)
bind/39/name = &"mixamorig_RightHandMiddle3"
bind/39/bone = -1
bind/39/pose = Transform3D(7.67034e-05, -1.9992e-06, 100, -100, -5.58804e-07, 7.88136e-05, 2.47705e-12, -100, -1.14175e-06, 12.104, -185.25, 299.94)
bind/40/name = &"mixamorig_RightHandMiddle4"
bind/40/bone = -1
bind/40/pose = Transform3D(7.67034e-05, -1.9992e-06, 100, -100, -5.58804e-07, 7.88136e-05, 2.47705e-12, -100, -1.14175e-06, 12.1041, -192.71, 299.94)
bind/41/name = &"mixamorig_RightHandThumb1"
bind/41/bone = -1
bind/41/pose = Transform3D(38.7301, 22.3611, 89.4425, -77.4593, -44.7216, 44.7218, 50.0004, -86.6023, -2.00089e-05, -0.744326, 14.7863, 333.975)
bind/42/name = &"mixamorig_RightHandThumb2"
bind/42/bone = -1
bind/42/pose = Transform3D(38.7302, 22.3611, 89.4425, -77.4593, -44.7216, 44.7218, 50.0004, -86.6023, -4.72937e-05, -0.744248, 4.43724, 333.976)
bind/43/name = &"mixamorig_RightHandThumb3"
bind/43/bone = -1
bind/43/pose = Transform3D(38.7302, 22.3611, 89.4425, -77.4594, -44.7214, 44.7219, 50.0002, -86.6024, 0.000150976, -0.744501, -4.13842, 333.976)
bind/44/name = &"mixamorig_RightHandThumb4"
bind/44/bone = -1
bind/44/pose = Transform3D(38.73, 22.3612, 89.4426, -77.4592, -44.7218, 44.7217, 50.0006, -86.6022, 5.82077e-05, -0.744883, -10.2759, 333.976)
bind/45/name = &"mixamorig_RightHandIndex1"
bind/45/bone = -1
bind/45/pose = Transform3D(8.07296e-05, -5.97738e-06, 100, -100, -5.58804e-07, 8.28397e-05, -6.04494e-13, -100, -5.11993e-06, 6.99748, -172.348, 299.393)
bind/46/name = &"mixamorig_RightHandIndex2"
bind/46/bone = -1
bind/46/pose = Transform3D(7.71745e-05, -2.47024e-06, 100, -100, -5.58804e-07, 7.92846e-05, 2.12874e-12, -100, -1.61279e-06, 6.99749, -179.441, 299.393)
bind/47/name = &"mixamorig_RightHandIndex3"
bind/47/bone = -1
bind/47/pose = Transform3D(7.77097e-05, -3.00546e-06, 100, -100, -5.58804e-07, 7.98198e-05, 1.72759e-12, -100, -2.14801e-06, 6.99748, -186.855, 299.393)
bind/48/name = &"mixamorig_RightHandIndex4"
bind/48/bone = -1
bind/48/pose = Transform3D(7.77097e-05, -3.00546e-06, 100, -100, -5.58804e-07, 7.98198e-05, 1.72759e-12, -100, -2.14801e-06, 6.99744, -192.378, 299.393)
bind/49/name = &"mixamorig_RightHandRing1"
bind/49/bone = -1
bind/49/pose = Transform3D(8.42064e-05, -8.73814e-06, 100, -100, -5.58805e-07, 8.63165e-05, -2.92757e-12, -100, -7.88069e-06, 16.0881, -169.833, 299.941)
bind/50/name = &"mixamorig_RightHandRing2"
bind/50/bone = -1
bind/50/pose = Transform3D(8.37108e-05, -9.00656e-06, 100, -100, 0.000445899, 8.58209e-05, -0.000446457, -100, -8.14873e-06, 16.0881, -176.691, 299.94)
bind/51/name = &"mixamorig_RightHandRing3"
bind/51/bone = -1
bind/51/pose = Transform3D(6.33971e-05, 1.13072e-05, 100, -100, -5.58695e-07, 6.55072e-05, -3.49916e-11, -100, 1.21646e-05, 16.088, -183.526, 299.941)
bind/52/name = &"mixamorig_RightHandRing4"
bind/52/bone = -1
bind/52/pose = Transform3D(0.000253585, -0.000178882, 100, -100, 0.000506614, 0.000255696, -0.000507173, -100, -0.000178023, 16.0889, -189.544, 299.94)
bind/53/name = &"mixamorig_RightHandPinky1"
bind/53/bone = -1
bind/53/pose = Transform3D(6.46733e-05, 1.04791e-05, 100, -100, -5.58803e-07, 6.67834e-05, 1.00308e-11, -100, 1.13366e-05, 20.6451, -166.735, 299.442)
bind/54/name = &"mixamorig_RightHandPinky2"
bind/54/bone = -1
bind/54/pose = Transform3D(0.000101329, -2.66244e-05, 100, -100, -5.58805e-07, 0.000103439, -2.16801e-11, -100, -2.5767e-05, 20.6453, -172.674, 299.442)
bind/55/name = &"mixamorig_RightHandPinky3"
bind/55/bone = -1
bind/55/pose = Transform3D(8.98217e-05, -1.51174e-05, 100, -100, -5.58805e-07, 9.19318e-05, -8.88232e-12, -100, -1.426e-05, 20.6452, -176.439, 299.442)
bind/56/name = &"mixamorig_RightHandPinky4"
bind/56/bone = -1
bind/56/pose = Transform3D(-8.98231e-05, 0.000164526, 100, -100, -0.000958654, -8.77114e-05, 0.000958095, -100, 0.000165384, 20.6444, -182.807, 299.444)
bind/57/name = &"mixamorig_LeftUpLeg"
bind/57/bone = -1
bind/57/pose = Transform3D(-99.9989, 0.47673, 0.00835485, -0.476803, -99.9831, -1.77224, -9.66054e-05, -1.77226, 99.9843, 17.5511, 195.39, 2.21604)
bind/58/name = &"mixamorig_LeftLeg"
bind/58/bone = -1
bind/58/pose = Transform3D(-99.9986, -0.525834, -0.0315128, 0.526778, -99.8177, -6.01202, 0.000156614, -6.0121, 99.8191, 18.6545, 109.769, 6.88281)
bind/59/name = &"mixamorig_LeftFoot"
bind/59/bone = -1
bind/59/pose = Transform3D(-99.6558, -5.47894, 6.22056, 8.2894, -65.8684, 74.7839, 1.77351e-05, 75.0422, 66.0959, 20.151, 18.7568, -14.9342)
bind/60/name = &"mixamorig_LeftToeBase"
bind/60/bone = -1
bind/60/pose = Transform3D(-99.9851, -0.0227067, -1.72832, -1.72847, 1.31393, 99.9764, 8.68106e-06, 99.9914, -1.31411, 21.5432, -18.5528, -3.02252)
bind/61/name = &"mixamorig_LeftToe_End"
bind/61/bone = -1
bind/61/pose = Transform3D(-99.9851, -0.022726, -1.72834, -1.72849, 1.31394, 99.9764, -1.00826e-05, 99.9914, -1.31412, 21.5432, -37.6176, -3.02251)
bind/62/name = &"mixamorig_RightUpLeg"
bind/62/bone = -1
bind/62/pose = Transform3D(-99.9979, -0.647505, 0.00783087, 0.647552, -99.9909, 1.18213, 0.00017401, 1.18215, 99.993, -17.2208, 194.856, -1.04611)
bind/63/name = &"mixamorig_RightLeg"
bind/63/bone = -1
bind/63/pose = Transform3D(-99.9976, 0.694097, 0.0420051, -0.695367, -99.8151, -6.03798, 1.62395e-05, -6.03812, 99.8175, -18.6954, 109.584, 6.89046)
bind/64/name = &"mixamorig_RightFoot"
bind/64/bone = -1
bind/64/pose = Transform3D(-99.5418, 6.2595, -7.22856, -9.56208, -65.1618, 75.2496, -1.09139e-05, 75.596, 65.4618, -20.3771, 18.3728, -15.1041)
bind/65/name = &"mixamorig_RightToeBase"
bind/65/bone = -1
bind/65/pose = Transform3D(-99.0345, -0.159739, -13.8615, -13.8624, 1.14128, 99.028, 1.17808e-05, 99.9934, -1.1524, -18.7761, -22.2602, -2.95062)
bind/66/name = &"mixamorig_RightToe_End"
bind/66/bone = -1
bind/66/pose = Transform3D(-99.0345, -0.159767, -13.8615, -13.8624, 1.14127, 99.028, -1.58735e-05, 99.9934, -1.1524, -18.7761, -41.9626, -2.95062)
[node name="Arms" type="Node3D"]
transform = Transform3D(-1, 0, -1.50996e-07, 0, 1, 0, 1.50996e-07, 0, -1, 0, 0, 0)
[node name="Pencil Case" type="MeshInstance3D" parent="."]
transform = Transform3D(0.98209, 0.177463, 0.0632861, 1.42223e-07, 0.335895, -0.941899, -0.18841, 0.92503, 0.32988, -0.376089, 1.33587, 0.356095)
cast_shadow = 0
mesh = SubResource("CylinderMesh_iro55")
skin = SubResource("Skin_cysku")

View File

@@ -87,3 +87,5 @@ surface_material_override/0 = SubResource("StandardMaterial3D_pfpgv")
shape = SubResource("ConcavePolygonShape3D_rit6o")
[node name="Players" type="Node" parent="."]
[node name="Entities" type="Node" parent="."]

View File

@@ -0,0 +1,20 @@
[gd_scene load_steps=3 format=3 uid="uid://c475s3klxqoej"]
[ext_resource type="ArrayMesh" path="res://Assets/Models/Weapons/pen_base.res" id="1_clcko"]
[ext_resource type="ArrayMesh" path="res://Assets/Models/Weapons/pen_lid.res" id="2_0u0nh"]
[node name="Stylo" type="Bullet"]
transform = Transform3D(3, 0, 0, 0, 3, 0, 0, 0, 3, 0, -7.45058e-09, 0)
[node name="Armature" type="Node3D" parent="."]
transform = Transform3D(5, 0, 0, 0, 0.0178025, -4.99997, 0, 4.99997, 0.0178025, 0, 0, -0.0828303)
[node name="pen_base" type="MeshInstance3D" parent="Armature"]
transform = Transform3D(0.140708, 0, 0, 0, -1.6822e-08, 0.140708, 0, -0.140708, -1.6822e-08, -1.12406e-11, 0.00809256, -4.84818e-06)
mesh = ExtResource("1_clcko")
skeleton = NodePath("")
[node name="pen_lid" type="MeshInstance3D" parent="Armature/pen_base"]
transform = Transform3D(1.14449, 0, 0, 0, 1.14449, 0, 0, 0, 1.14449, 7.98797e-11, 5.07782e-10, -0.0671831)
mesh = ExtResource("2_0u0nh")
skeleton = NodePath("")

View File

@@ -57,3 +57,15 @@ escape={
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194305,"key_label":0,"unicode":0,"echo":false,"script":null)
]
}
shoot={
"deadzone": 0.5,
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":1,"canceled":false,"pressed":false,"double_click":false,"script":null)
]
}
[layer_names]
3d_physics/layer_1="World"
3d_physics/layer_2="No Team"
3d_physics/layer_3="Team 1"
3d_physics/layer_4="Team 2"

View File

@@ -0,0 +1,11 @@
#pragma once
#include <client/Player.h>
namespace blitz {
namespace PlayerFactory {
Player* CreateStudent();
} // namespace PlayerFactory
} // namespace blitz

View File

@@ -0,0 +1,11 @@
#pragma once
#include <client/Bullet.h>
namespace blitz {
namespace ProjectileFactory {
Bullet* CreatePen();
} // namespace ProjectileFactory
} // namespace blitz

View File

@@ -25,13 +25,15 @@ class World : public godot::Node3D, public protocol::PacketHandler {
void HandlePacket(const protocol::packets::PlayerJoin&) override;
void HandlePacket(const protocol::packets::PlayerLeave&) override;
void HandlePacket(const protocol::packets::PlayerShoot&) override;
protected:
NetworkInterface* m_NetworkInterface;
godot::Node* m_Players;
float m_PassedTime;
virtual void AddProjectile(
PlayerID a_Shooter, const godot::Vector3& a_Position, const godot::Vector3& a_Rotation, const godot::Vector3& a_Velocity);
virtual void AddPlayer(PlayerID a_PlayerId, godot::String a_PlayerName);
virtual void RemovePlayer(PlayerID a_PlayerId);
virtual void SetPlayerPositionAndRotation(

View File

@@ -1,9 +1,9 @@
#pragma once
#include <blitz/common/Types.h>
#include <vector>
#include <godot_cpp/variant/string.hpp>
#include <godot_cpp/variant/vector3.hpp>
#include <vector>
namespace blitz {
namespace protocol {
@@ -66,7 +66,12 @@ struct PlayerPositionAndRotation {
godot::Vector3 m_Velocity;
};
struct PlayerShoot {};
struct PlayerShoot {
PlayerID m_Sender;
godot::Vector3 m_Position;
godot::Vector3 m_Rotation;
godot::Vector3 m_Velocity;
};
} // namespace data
} // namespace protocol

25
include/client/Bullet.h Normal file
View File

@@ -0,0 +1,25 @@
#pragma once
#include <godot_cpp/classes/node3d.hpp>
#include <godot_cpp/classes/ray_cast3d.hpp>
namespace blitz {
class Bullet : public godot::Node3D {
GDCLASS(Bullet, godot::Node3D)
protected:
static void _bind_methods();
public:
Bullet();
~Bullet();
void _process(float delta);
void _ready() override;
private:
bool m_Stuck;
void Destroy();
};
} // namespace blitz

View File

@@ -1,17 +1,18 @@
#pragma once
#include <blitz/common/Types.h>
#include <godot_cpp/classes/animation_tree.hpp>
#include <godot_cpp/classes/character_body3d.hpp>
#include <godot_cpp/classes/node3d.hpp>
#include <blitz/common/Types.h>
namespace blitz {
class World;
class PlayerController;
class Player : public godot::Node {
class Player : public godot::CharacterBody3D {
GDCLASS(Player, godot::Node);
GDCLASS(Player, godot::CharacterBody3D);
protected:
static void _bind_methods();
@@ -39,9 +40,7 @@ class Player : public godot::Node {
protected:
godot::Node3D* m_Mesh;
godot::Node3D* m_Head;
godot::AnimationTree* m_AnimationTree;
godot::CharacterBody3D* m_Player;
godot::Vector3 m_SnapVector;
PeerID m_PeerId;
@@ -51,5 +50,6 @@ class Player : public godot::Node {
void BlendAnimation(const godot::String& a_AnimationName, float a_Goal, float a_Delta);
friend class World;
friend class PlayerController;
};
} // namespace blitz

View File

@@ -5,29 +5,35 @@
namespace blitz {
class FirstPersonPlayer : public Player {
GDCLASS(FirstPersonPlayer, godot::Node)
class NetworkInterface;
class PlayerController : public godot::Node {
GDCLASS(PlayerController, godot::Node)
protected:
static void _bind_methods();
public:
FirstPersonPlayer();
~FirstPersonPlayer();
PlayerController();
~PlayerController();
// Godot overrides
void _unhandled_input(const godot::Ref<godot::InputEvent>&);
void _physics_process(float delta) override;
void _process(float delta);
void _ready();
private:
godot::Camera3D* m_Camera;
float m_BobTime;
float m_Speed;
Player* m_Player;
godot::Node3D* m_Head;
NetworkInterface* m_NetworkInterface;
void UpdateBobbing(float delta);
void UpdateFOV(float delta);
void UpdateCamera(const godot::InputEventMouseMotion&);
void UpdatePosition(float delta);
void UpdateVelocity(float delta);
void Shoot();
};
} // namespace blitz

View File

@@ -0,0 +1,17 @@
#include <blitz/factory/PlayerFactory.h>
#include <godot_cpp/classes/packed_scene.hpp>
#include <godot_cpp/classes/resource_loader.hpp>
namespace blitz {
namespace PlayerFactory {
using namespace godot;
Player* CreateStudent() {
Ref<PackedScene> scene = ResourceLoader::get_singleton()->load("res://Scenes/Characters/remy.tscn");
return Object::cast_to<Player>(scene->instantiate());
}
} // namespace PlayerFactory
} // namespace blitz

View File

@@ -0,0 +1,17 @@
#include <blitz/factory/ProjectileFactory.h>
#include <godot_cpp/classes/packed_scene.hpp>
#include <godot_cpp/classes/resource_loader.hpp>
namespace blitz {
namespace ProjectileFactory {
using namespace godot;
Bullet* CreatePen() {
Ref<PackedScene> bulletScene = ResourceLoader::get_singleton()->load("res://Scenes/Weapons/pen.tscn");
return Object::cast_to<Bullet>(bulletScene->instantiate());
}
} // namespace ProjectileFactory
} // namespace blitz

View File

@@ -1,12 +1,12 @@
#include <blitz/godot/World.h>
#include <blitz/factory/PlayerFactory.h>
#include <blitz/factory/ProjectileFactory.h>
#include <blitz/godot/NetworkInterface.h>
#include <client/FirstPersonPlayer.h>
#include <client/Player.h>
#include <client/PlayerController.h>
#include <godot_cpp/classes/engine.hpp>
#include <godot_cpp/classes/multiplayer_api.hpp>
#include <godot_cpp/classes/packed_scene.hpp>
#include <godot_cpp/classes/resource_loader.hpp>
#include <godot_cpp/variant/utility_functions.hpp>
@@ -14,8 +14,6 @@ using namespace godot;
namespace blitz {
static const char PlayerScenePath[] = "res://Scenes/Characters/remy.tscn";
void World::_bind_methods() {}
void World::_ready() {
@@ -31,6 +29,7 @@ void World::_ready() {
m_NetworkInterface->RegisterHandler(protocol::PacketType::PlayerJoin, *this);
m_NetworkInterface->RegisterHandler(protocol::PacketType::PlayerLeave, *this);
m_NetworkInterface->RegisterHandler(protocol::PacketType::PlayerPositionAndRotation, *this);
m_NetworkInterface->RegisterHandler(protocol::PacketType::PlayerShoot, *this);
}
@@ -63,30 +62,23 @@ void World::HandlePacket(const protocol::packets::PlayerLeave& a_PlayerLeave) {
RemovePlayer(a_PlayerLeave.m_Data.m_PlayerId);
}
void World::HandlePacket(const protocol::packets::PlayerShoot& a_PlayerShoot) {
const protocol::data::PlayerShoot& playerShoot = a_PlayerShoot.m_Data;
AddProjectile(playerShoot.m_Sender, playerShoot.m_Position, playerShoot.m_Rotation, playerShoot.m_Velocity);
}
void World::AddPlayer(PlayerID a_PlayerId, String a_PlayerName) {
UtilityFunctions::print("New Player with id : ", a_PlayerId, " and name ", a_PlayerName);
Player* player = PlayerFactory::CreateStudent();
player->set_name(UtilityFunctions::var_to_str(a_PlayerId));
player->m_PeerId = a_PlayerId;
m_Players->add_child(player);
if (a_PlayerId == get_multiplayer()->get_unique_id()) {
Ref<PackedScene> serverScene = ResourceLoader::get_singleton()->load(PlayerScenePath);
Node* playerContent = serverScene->instantiate();
FirstPersonPlayer* player = memnew(FirstPersonPlayer);
player->set_name(UtilityFunctions::var_to_str(a_PlayerId));
player->m_PeerId = a_PlayerId;
player->add_child(playerContent);
m_Players->add_child(player);
} else {
Ref<PackedScene> serverScene = ResourceLoader::get_singleton()->load(PlayerScenePath);
Node* playerContent = serverScene->instantiate();
Player* player = memnew(Player);
player->set_name(UtilityFunctions::var_to_str(a_PlayerId));
player->m_PeerId = a_PlayerId;
player->add_child(playerContent);
m_Players->add_child(player);
PlayerController* playerController = memnew(PlayerController);
player->add_child(playerController);
}
}
@@ -108,4 +100,22 @@ void World::SetPlayerPositionAndRotation(
}
}
void World::AddProjectile(
PlayerID a_Shooter, const godot::Vector3& a_Position, const godot::Vector3& a_Rotation, const godot::Vector3& a_Velocity) {
Player* shooter = GetPlayerById(a_Shooter);
if (!shooter)
return;
Bullet* bullet = ProjectileFactory::CreatePen();
bullet->set_position(a_Position);
Transform3D bulletTransform = bullet->get_transform();
bulletTransform.basis.set_euler(a_Rotation);
bullet->set_transform(bulletTransform);
Node* entities = get_node<Node>("WorldContent/Entities");
entities->add_child(bullet);
}
} // namespace blitz

View File

@@ -272,9 +272,13 @@ void Deserializer::DeserializePacketData(data::PlayerPositionAndRotation& a_Pack
void Serializer::SerializePacketData(const data::PlayerShoot& a_Packet) {}
void Serializer::SerializePacketData(const data::PlayerShoot& a_Packet) {
m_Buffer << a_Packet.m_Sender << a_Packet.m_Position << a_Packet.m_Rotation << a_Packet.m_Velocity;
}
void Deserializer::DeserializePacketData(data::PlayerShoot& a_Packet) {}
void Deserializer::DeserializePacketData(data::PlayerShoot& a_Packet) {
m_Buffer >> a_Packet.m_Sender >> a_Packet.m_Position >> a_Packet.m_Rotation >> a_Packet.m_Velocity;
}

63
src/client/Bullet.cpp Normal file
View File

@@ -0,0 +1,63 @@
#include <client/Bullet.h>
#include <godot_cpp/classes/engine.hpp>
#include <godot_cpp/classes/geometry_instance3d.hpp>
#include <godot_cpp/classes/physics_direct_space_state3d.hpp>
#include <godot_cpp/classes/physics_ray_query_parameters3d.hpp>
#include <godot_cpp/classes/timer.hpp>
#include <godot_cpp/classes/world3d.hpp>
#include <godot_cpp/variant/utility_functions.hpp>
namespace blitz {
using namespace godot;
static constexpr float SPEED = 20.0f;
static constexpr float MaxAlive = 10.0f;
void Bullet::_bind_methods() {}
Bullet::Bullet() : m_Stuck(false) {}
void Bullet::_ready() {
Timer* timer = memnew(Timer);
add_child(timer);
timer->connect("timeout", callable_mp(this, &Bullet::Destroy));
timer->set_wait_time(MaxAlive);
timer->start();
}
Bullet::~Bullet() {}
void Bullet::_process(float a_Delta) {
if (Engine::get_singleton()->is_editor_hint()) {
return;
}
auto* head = get_node<Node3D>("Armature");
if (m_Stuck)
return;
Vector3 start = get_position();
Vector3 finish = start + get_transform().basis.xform(Vector3{0, 0, -SPEED * a_Delta});
auto query = PhysicsRayQueryParameters3D::create(start, finish, 1);
auto result = get_world_3d()->get_direct_space_state()->intersect_ray(query);
if (result.is_empty()) {
set_position(finish);
return;
}
m_Stuck = true;
Vector3 intersectPoint = result["position"];
head->set_global_position(intersectPoint);
}
void Bullet::Destroy() {
queue_free();
}
} // namespace blitz

View File

@@ -3,6 +3,8 @@
#include <godot_cpp/classes/engine.hpp>
#include <godot_cpp/classes/input.hpp>
#include <godot_cpp/classes/input_map.hpp>
#include <godot_cpp/classes/mesh_instance3d.hpp>
#include <godot_cpp/classes/skeleton3d.hpp>
#include <godot_cpp/core/class_db.hpp>
#include <godot_cpp/variant/utility_functions.hpp>
@@ -29,19 +31,13 @@ void Player::_ready() {
return;
}
m_Player = get_node<CharacterBody3D>("Player");
DEV_ASSERT(m_Player);
// we set the player to an invalid position
m_Player->set_position({-99999, -999999, -999999});
set_position({-99999, -999999, -999999});
m_Head = get_node<Node3D>("Player/Head");
DEV_ASSERT(m_Head);
m_Mesh = get_node<Node3D>("Player/Armature");
m_Mesh = get_node<Node3D>("Armature");
DEV_ASSERT(m_Mesh);
m_AnimationTree = get_node<AnimationTree>("Player/AnimationTree");
m_AnimationTree = get_node<AnimationTree>("AnimationTree");
DEV_ASSERT(m_AnimationTree);
}
@@ -49,29 +45,29 @@ void Player::_physics_process(float delta) {
if (godot::Engine::get_singleton()->is_editor_hint())
return;
m_Player->move_and_slide();
move_and_slide();
UpdateAnimation(delta);
}
Vector3 Player::GetPosition() const {
return m_Player->get_position();
return get_position();
}
void Player::SetPosition(const Vector3& a_Position) {
m_Player->set_position(a_Position);
set_position(a_Position);
}
Vector3 Player::GetVelocity() const {
return m_Player->get_velocity();
return get_velocity();
}
void Player::SetVelocity(const Vector3& a_Velocity) {
m_Player->set_velocity(a_Velocity);
set_velocity(a_Velocity);
}
void Player::UpdateAnimation(float a_Delta) {
Vector3 velocity = m_Player->get_velocity();
float angle = m_Player->get_rotation().y;
Vector3 velocity = get_velocity();
float angle = get_rotation().y;
Vector3 direction = velocity.rotated({0, 1, 0}, -angle);
if (direction.length() < 1.0f) {
@@ -89,8 +85,8 @@ void Player::UpdateAnimation(float a_Delta) {
float ratio = 0.5f - (UtilityFunctions::absf(direction.z) - UtilityFunctions::absf(direction.x)) * 0.5f;
BlendAnimation("parameters/Movement/Walking/blend_amount", ratio, a_Delta);
m_AnimationTree->set("parameters/conditions/jump", !m_Player->is_on_floor() && m_Player->get_velocity().y > 0.0f);
m_AnimationTree->set("parameters/conditions/is_on_floor", m_Player->is_on_floor());
m_AnimationTree->set("parameters/conditions/jump", !is_on_floor() && get_velocity().y > 0.0f);
m_AnimationTree->set("parameters/conditions/is_on_floor", is_on_floor());
}
void Player::BlendAnimation(const godot::String& a_AnimationName, float a_Goal, float a_Delta) {
@@ -98,14 +94,28 @@ void Player::BlendAnimation(const godot::String& a_AnimationName, float a_Goal,
a_AnimationName, UtilityFunctions::lerp(m_AnimationTree->get(a_AnimationName), a_Goal, a_Delta * AnimationBlend));
}
void Player::SetModelVisible(bool visible) {}
void Player::SetModelVisible(bool a_Visible) {
auto* skeleton = m_Mesh->get_node<Skeleton3D>("Skeleton3D");
for (int i = 0; i < skeleton->get_child_count(); i++) {
auto* bodyPart = Object::cast_to<MeshInstance3D>(skeleton->get_child(i));
if (bodyPart)
bodyPart->set_cast_shadows_setting(a_Visible
? GeometryInstance3D::ShadowCastingSetting::SHADOW_CASTING_SETTING_ON
: GeometryInstance3D::ShadowCastingSetting::SHADOW_CASTING_SETTING_SHADOWS_ONLY);
}
// TODO: dirty, make it recursive
auto* pencilCase = m_Mesh->get_node<MeshInstance3D>("Skeleton3D/Hand/Pencil Case");
pencilCase->set_cast_shadows_setting(a_Visible ? GeometryInstance3D::ShadowCastingSetting::SHADOW_CASTING_SETTING_ON
: GeometryInstance3D::ShadowCastingSetting::SHADOW_CASTING_SETTING_SHADOWS_ONLY);
}
Vector3 Player::GetCameraRotation() const {
return m_Player->get_rotation();
return get_rotation();
}
void Player::SetCameraRotation(const Vector3& a_Rotation) {
m_Player->set_rotation(a_Rotation);
set_rotation(a_Rotation);
}
} // namespace blitz

View File

@@ -1,5 +1,7 @@
#include <client/FirstPersonPlayer.h>
#include <client/PlayerController.h>
#include <blitz/factory/ProjectileFactory.h>
#include <blitz/godot/NetworkInterface.h>
#include <godot_cpp/classes/camera3d.hpp>
#include <godot_cpp/classes/engine.hpp>
#include <godot_cpp/classes/input.hpp>
@@ -37,15 +39,13 @@ static constexpr float MAX_FOV_VELOCITY = SPRINT_SPEED * 2.0f;
static const float LerpValue = 0.10;
static const float AnimationBlend = 7.0;
void FirstPersonPlayer::_bind_methods() {}
void PlayerController::_bind_methods() {}
FirstPersonPlayer::FirstPersonPlayer() : Player(), m_BobTime(0) {}
PlayerController::PlayerController() : m_BobTime(0) {}
FirstPersonPlayer::~FirstPersonPlayer() {}
void FirstPersonPlayer::_ready() {
Player::_ready();
PlayerController::~PlayerController() {}
void PlayerController::_ready() {
InputMap::get_singleton()->load_from_project_settings();
if (!Engine::get_singleton()->is_editor_hint()) {
Input::get_singleton()->set_mouse_mode(Input::MOUSE_MODE_CAPTURED);
@@ -53,16 +53,28 @@ void FirstPersonPlayer::_ready() {
return;
}
m_Player = Object::cast_to<Player>(get_parent());
m_Head = m_Player->get_node<Node3D>("Head");
DEV_ASSERT(m_Head);
m_Head->set_visible(true);
m_Camera = memnew(Camera3D);
m_Camera->set_name("FirstPersonCamera");
m_Head->add_child(m_Camera);
m_Camera->make_current();
SetPosition({0, 100, 0});
SetVelocity({0, 0, 0});
m_Player->SetModelVisible(false);
m_Player->SetPosition({0, 1, 0});
m_Player->SetVelocity({0, 0, 0});
m_NetworkInterface = m_Player->get_node<NetworkInterface>("../../../../Network");
DEV_ASSERT(m_NetworkInterface);
}
void FirstPersonPlayer::_unhandled_input(const godot::Ref<godot::InputEvent>& a_Event) {
void PlayerController::_unhandled_input(const godot::Ref<godot::InputEvent>& a_Event) {
auto* event = Object::cast_to<InputEventMouseMotion>(a_Event.ptr());
if (event)
UpdateCamera(*event);
@@ -75,7 +87,7 @@ void FirstPersonPlayer::_unhandled_input(const godot::Ref<godot::InputEvent>& a_
}
}
void FirstPersonPlayer::_physics_process(float a_Delta) {
void PlayerController::_process(float a_Delta) {
#if DEBUG_ENABLED
if (Engine::get_singleton()->is_editor_hint()) {
return;
@@ -85,25 +97,31 @@ void FirstPersonPlayer::_physics_process(float a_Delta) {
auto* Input = Input::get_singleton();
if (!m_Player->is_on_floor())
SetVelocity(GetVelocity() - Vector3{0, GRAVITY * a_Delta, 0});
m_Player->SetVelocity(m_Player->GetVelocity() - Vector3{0, GRAVITY * a_Delta, 0});
if (Input->is_action_pressed("jump") && m_Player->is_on_floor())
SetVelocity({GetVelocity().x, JUMP_VELOCITY, GetVelocity().z});
m_Player->SetVelocity({m_Player->GetVelocity().x, JUMP_VELOCITY, m_Player->GetVelocity().z});
m_Speed = Input->is_action_pressed("sprint") ? SPRINT_SPEED : WALK_SPEED;
UpdatePosition(a_Delta);
UpdateFOV(a_Delta);
UpdateBobbing(a_Delta);
UpdateVelocity(a_Delta);
m_Player->move_and_slide();
UpdateAnimation(a_Delta);
Shoot();
}
void FirstPersonPlayer::UpdateBobbing(float a_Delta) {
m_BobTime += a_Delta * GetVelocity().length() * m_Player->is_on_floor();
void PlayerController::Shoot() {
if (Input::get_singleton()->is_action_pressed("shoot")) {
// we don't use velocity yet
protocol::packets::PlayerShoot packet(
{m_Player->GetId(), m_Camera->get_global_position(), m_Camera->get_global_transform().basis.get_euler(), {}});
m_NetworkInterface->BroadcastPacket(packet);
}
}
void PlayerController::UpdateBobbing(float a_Delta) {
m_BobTime += a_Delta * m_Player->GetVelocity().length() * m_Player->is_on_floor();
Vector3 newPos{static_cast<float>(Math::cos(m_BobTime * BOB_FREQ / 2.0) * BOB_AMP),
static_cast<float>(Math::sin(m_BobTime * BOB_FREQ) * BOB_AMP), 0};
@@ -111,16 +129,16 @@ void FirstPersonPlayer::UpdateBobbing(float a_Delta) {
// m_Camera->set_transform({m_Camera->get_transform().basis, newPos});
}
void FirstPersonPlayer::UpdateCamera(const InputEventMouseMotion& a_Event) {
void PlayerController::UpdateCamera(const InputEventMouseMotion& a_Event) {
m_Player->rotate_y(-a_Event.get_relative().x * SENSITIVITY);
m_Camera->rotate_x(-a_Event.get_relative().y * SENSITIVITY);
m_Head->rotate_x(-a_Event.get_relative().y * SENSITIVITY);
float rotationX = m_Camera->get_rotation().x;
float rotationX = m_Head->get_rotation().x;
rotationX = CLAMP(rotationX, Math::deg_to_rad(-80.0), Math::deg_to_rad(80.0));
m_Camera->set_rotation({rotationX, m_Camera->get_rotation().y, m_Camera->get_rotation().z});
m_Head->set_rotation({rotationX, m_Head->get_rotation().y, m_Head->get_rotation().z});
}
void FirstPersonPlayer::UpdatePosition(float delta) {
void PlayerController::UpdateVelocity(float delta) {
auto* Input = Input::get_singleton();
Vector2 inputDirection = Input->get_vector("move_left", "move_right", "move_forwards", "move_backwards");
@@ -128,25 +146,25 @@ void FirstPersonPlayer::UpdatePosition(float delta) {
if (m_Player->is_on_floor()) {
if (!direction.is_zero_approx()) {
SetVelocity({direction.x * m_Speed, GetVelocity().y, direction.z * m_Speed});
m_Player->SetVelocity({direction.x * m_Speed, m_Player->GetVelocity().y, direction.z * m_Speed});
} else {
SetVelocity({Math::lerp(static_cast<float>(GetVelocity().x), static_cast<float>(direction.x * m_Speed),
static_cast<float>(delta * GROUND_FRICTION)),
GetVelocity().y,
Math::lerp(static_cast<float>(GetVelocity().z), static_cast<float>(direction.z * m_Speed),
m_Player->SetVelocity({Math::lerp(static_cast<float>(m_Player->GetVelocity().x), static_cast<float>(direction.x * m_Speed),
static_cast<float>(delta * GROUND_FRICTION)),
m_Player->GetVelocity().y,
Math::lerp(static_cast<float>(m_Player->GetVelocity().z), static_cast<float>(direction.z * m_Speed),
static_cast<float>(delta * GROUND_FRICTION))});
}
} else {
SetVelocity({Math::lerp(static_cast<float>(GetVelocity().x), static_cast<float>(direction.x * m_Speed),
static_cast<float>(delta * AIR_MOVEMENT)),
GetVelocity().y,
Math::lerp(static_cast<float>(GetVelocity().z), static_cast<float>(direction.z * m_Speed),
m_Player->SetVelocity({Math::lerp(static_cast<float>(m_Player->GetVelocity().x), static_cast<float>(direction.x * m_Speed),
static_cast<float>(delta * AIR_MOVEMENT)),
m_Player->GetVelocity().y,
Math::lerp(static_cast<float>(m_Player->GetVelocity().z), static_cast<float>(direction.z * m_Speed),
static_cast<float>(delta * AIR_MOVEMENT))});
}
}
void FirstPersonPlayer::UpdateFOV(float a_Delta) {
float velocityClamped = Math::clamp(GetVelocity().length(), MIN_FOV_VELOCITY, MAX_FOV_VELOCITY);
void PlayerController::UpdateFOV(float a_Delta) {
float velocityClamped = Math::clamp(m_Player->GetVelocity().length(), MIN_FOV_VELOCITY, MAX_FOV_VELOCITY);
float targetFOV = BASE_FOV + FOV_CHANGE * velocityClamped;
m_Camera->set_fov(Math::lerp(static_cast<float>(m_Camera->get_fov()), targetFOV, a_Delta * FOV_TRANSITION));
}

View File

@@ -1,9 +1,10 @@
#include <blitz/godot/NetworkInterface.h>
#include <client/Bullet.h>
#include <client/ClientWorld.h>
#include <client/FirstPersonPlayer.h>
#include <client/Main.h>
#include <client/MainMenu.h>
#include <client/Player.h>
#include <client/PlayerController.h>
#include <server/Server.h>
#include <server/ServerWorld.h>
@@ -15,7 +16,7 @@ using namespace godot;
static void RegisterClasses() {
GDREGISTER_CLASS(blitz::Player);
GDREGISTER_CLASS(blitz::FirstPersonPlayer);
GDREGISTER_CLASS(blitz::PlayerController);
GDREGISTER_CLASS(blitz::MainMenu);
GDREGISTER_CLASS(blitz::Main);
GDREGISTER_CLASS(blitz::NetworkInterface);
@@ -23,6 +24,7 @@ static void RegisterClasses() {
GDREGISTER_ABSTRACT_CLASS(blitz::World);
GDREGISTER_CLASS(blitz::ClientWorld);
GDREGISTER_CLASS(blitz::ServerWorld);
GDREGISTER_CLASS(blitz::Bullet);
}
static void initialize_blitz_module(ModuleInitializationLevel p_level) {