WIP: Add basic ragdoll
This commit is contained in:
parent
66cbb87eaa
commit
642d84c0ad
@ -4,7 +4,7 @@ extends Node3D
|
||||
var owner_placeholder: CharacterBody3D = null
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
print("ready")
|
||||
$Body/Armature/Skeleton3D.physical_bones_start_simulation()
|
||||
owner_placeholder = _get_owner()
|
||||
pass # Replace with function body.
|
||||
|
||||
@ -18,10 +18,23 @@ 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"):
|
||||
owner_placeholder.take_damage(dam)
|
||||
if owner_placeholder:
|
||||
owner_placeholder.take_damage(dam)
|
||||
pass # Replace with function body.
|
||||
|
||||
func _get_owner() -> CharacterBody3D:
|
||||
var owner_placeholder := find_parent("PlayerPlaceholder*")
|
||||
return owner_placeholder
|
||||
|
||||
|
||||
func die():
|
||||
for child in $Body/Armature/Skeleton3D/PhysicalBoneSimulator3D.get_children():
|
||||
if child is PhysicalBone3D:
|
||||
child.collision_layer = 1
|
||||
child.collision_mask = 1
|
||||
$Body/Armature/Skeleton3D.physical_bones_stop_simulation()
|
||||
$Body/Armature/Skeleton3D/PhysicalBoneSimulator3D.physical_bones_start_simulation()
|
||||
func make_invisible():
|
||||
$Body/Armature/Skeleton3D/Alpha_Joints.set_layer_mask_value(1, false)
|
||||
$Body/Armature/Skeleton3D/Alpha_Surface.set_layer_mask_value(1, false)
|
||||
$Body/Armature/Skeleton3D/Alpha_Joints.set_layer_mask_value(2, true)
|
||||
$Body/Armature/Skeleton3D/Alpha_Surface.set_layer_mask_value(2, true)
|
||||
|
@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=12 format=4 uid="uid://1txob6jskn5s"]
|
||||
[gd_scene load_steps=27 format=4 uid="uid://1txob6jskn5s"]
|
||||
|
||||
[ext_resource type="Script" path="res://scenes/characters/blue/dummy.gd" id="1_cyeub"]
|
||||
[ext_resource type="Script" path="res://scenes/characters/blue/head_collision.gd" id="1_lianf"]
|
||||
@ -258,9 +258,68 @@ blend_shape_mode = 0
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_j3emx"]
|
||||
albedo_color = Color(0, 0, 1, 1)
|
||||
|
||||
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_k5bjr"]
|
||||
radius = 11.245
|
||||
height = 27.8
|
||||
[sub_resource type="SphereShape3D" id="SphereShape3D_wnhib"]
|
||||
radius = 1.2
|
||||
|
||||
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_0ptuo"]
|
||||
radius = 11.7055
|
||||
height = 28.953
|
||||
|
||||
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_126jt"]
|
||||
radius = 3.944
|
||||
height = 12.926
|
||||
|
||||
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_1gw5y"]
|
||||
radius = 10.779
|
||||
height = 24.58
|
||||
|
||||
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_krlof"]
|
||||
radius = 2.74047
|
||||
height = 27.4047
|
||||
|
||||
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_2k34c"]
|
||||
radius = 2.76145
|
||||
height = 27.6145
|
||||
|
||||
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_5fgdh"]
|
||||
radius = 5.286
|
||||
height = 20.647
|
||||
|
||||
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_8vkyv"]
|
||||
radius = 2.74047
|
||||
height = 27.4047
|
||||
|
||||
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_fh1k4"]
|
||||
radius = 2.76144
|
||||
height = 27.6144
|
||||
|
||||
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_1m8r5"]
|
||||
radius = 5.286
|
||||
height = 20.647
|
||||
|
||||
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_3cygo"]
|
||||
radius = 4.05994
|
||||
height = 40.5994
|
||||
|
||||
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_vwdij"]
|
||||
radius = 4.2099
|
||||
height = 42.099
|
||||
|
||||
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_qyg6j"]
|
||||
radius = 1.57216
|
||||
height = 15.7216
|
||||
|
||||
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_a81km"]
|
||||
radius = 4.05995
|
||||
height = 40.5995
|
||||
|
||||
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_usdnr"]
|
||||
radius = 4.2099
|
||||
height = 42.099
|
||||
|
||||
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_p687f"]
|
||||
radius = 1.57216
|
||||
height = 15.7216
|
||||
|
||||
[sub_resource type="Animation" id="Animation_6g1lc"]
|
||||
resource_name = "Run Forward"
|
||||
@ -867,7 +926,7 @@ _data = {
|
||||
}
|
||||
|
||||
[node name="Dummy" type="Node3D"]
|
||||
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 0, 0)
|
||||
transform = Transform3D(-1, 0, -1.50996e-07, 0, 1, 0, 1.50996e-07, 0, -1, 0, 0, 0)
|
||||
script = ExtResource("1_cyeub")
|
||||
|
||||
[node name="Body" type="Node3D" parent="."]
|
||||
@ -1353,9 +1412,245 @@ transform = Transform3D(9.90229, 1.3945, -6.09554e-08, 0, -4.37114e-07, -10, -1.
|
||||
script = ExtResource("1_lianf")
|
||||
|
||||
[node name="Collision" type="CollisionShape3D" parent="Body/Armature/Skeleton3D/BoneAttachment3D/HeadCollision"]
|
||||
shape = SubResource("CapsuleShape3D_k5bjr")
|
||||
shape = SubResource("SphereShape3D_wnhib")
|
||||
|
||||
[node name="CSGCylinder3D" type="CSGCylinder3D" parent="Body/Armature/Skeleton3D/BoneAttachment3D"]
|
||||
[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.81955, 12.756, -10.563, 98.619, 1.31497, 0.290618, -87.4646)
|
||||
collision_layer = 4
|
||||
collision_mask = 4
|
||||
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2.81943e-10, -1.16415e-08, 0.0499954)
|
||||
body_offset = Transform3D(100, -0.0695305, -0.00860238, -9.53674e-07, 12.2744, -99.2438, 0.0700531, 99.2438, 12.2744, 0.000430107, 4.96174, -0.613665)
|
||||
bone_name = "mixamorig_Hips"
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Body/Armature/Skeleton3D/PhysicalBoneSimulator3D/Physical Bone mixamorig_Hips"]
|
||||
transform = Transform3D(0.01, 0, 0, 0, -4.37114e-10, 0.01, 0, -0.01, -4.37114e-10, 0.0161502, -2.32831e-11, 1.01774e-18)
|
||||
shape = SubResource("CapsuleShape3D_0ptuo")
|
||||
|
||||
[node name="Physical Bone mixamorig_Spine" type="PhysicalBone3D" parent="Body/Armature/Skeleton3D/PhysicalBoneSimulator3D"]
|
||||
transform = Transform3D(80.9412, -58.5461, -4.56914, 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, -6.4599e-09, -1.06821e-08, 0.05866)
|
||||
body_offset = Transform3D(100, 7.62939e-06, -5.24521e-06, 4.76837e-07, -1.04904e-05, -100, -3.8147e-06, 100, -1.43051e-05, 9.53674e-07, 5.866, 1.90735e-06)
|
||||
bone_name = "mixamorig_Spine"
|
||||
joint_constraints/bias = 0.3
|
||||
joint_constraints/damping = 1.0
|
||||
joint_constraints/impulse_clamp = 0.0
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Body/Armature/Skeleton3D/PhysicalBoneSimulator3D/Physical Bone mixamorig_Spine"]
|
||||
transform = Transform3D(0.0318071, 3.86358e-14, 4.9738e-14, -2.13163e-14, -1.62981e-09, 0.0318071, -4.26326e-14, -0.0318071, -1.62981e-09, -0.00245133, -5.91656e-09, -0.223859)
|
||||
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.8368, -79.471, -58.5966, 13.5638, -60.5339, 78.4326, -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, -1.66189e-08, -2.79397e-08, 0.0981526)
|
||||
body_offset = Transform3D(-100, -0.00221062, -0.000803947, -2.38419e-06, 33.8066, -94.1122, 0.00232697, -94.1122, -33.8066, 7.72476e-05, 9.23737, 3.3182)
|
||||
bone_name = "mixamorig_Head"
|
||||
joint_constraints/bias = 0.3
|
||||
joint_constraints/damping = 1.0
|
||||
joint_constraints/impulse_clamp = 0.0
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Body/Armature/Skeleton3D/PhysicalBoneSimulator3D/Physical Bone mixamorig_Head"]
|
||||
transform = Transform3D(0.01, 0, 0, 0, -4.37114e-10, 0.01, 0, -0.01, -4.37114e-10, 0, 0, 0)
|
||||
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)
|
||||
collision_layer = 4
|
||||
collision_mask = 4
|
||||
joint_type = 1
|
||||
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -3.29199e-08, -5.01588e-08, 0.137023)
|
||||
body_offset = Transform3D(100, -5.72205e-06, -3.8147e-06, 1.90735e-06, 100, -1.90735e-05, 1.90735e-06, -3.8147e-06, 100, 3.8147e-06, 7.62939e-06, -13.7023)
|
||||
bone_name = "mixamorig_LeftArm"
|
||||
joint_constraints/bias = 0.3
|
||||
joint_constraints/damping = 1.0
|
||||
joint_constraints/impulse_clamp = 0.0
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Body/Armature/Skeleton3D/PhysicalBoneSimulator3D/Physical Bone mixamorig_LeftArm"]
|
||||
transform = Transform3D(0.01, 0, 0, 0, 0.00997432, -0.000716193, 0, 0.000716193, 0.00997432, 4.61853e-15, 0.165399, 0.142978)
|
||||
shape = SubResource("CapsuleShape3D_krlof")
|
||||
|
||||
[node name="Physical Bone mixamorig_LeftForeArm" type="PhysicalBone3D" parent="Body/Armature/Skeleton3D/PhysicalBoneSimulator3D"]
|
||||
transform = Transform3D(-48.2566, -12.058, 86.752, -78.7312, -37.4258, -48.997, 38.3757, -91.9452, 8.56702, 1.36482, 46.9033, -104.66)
|
||||
collision_layer = 4
|
||||
collision_mask = 4
|
||||
joint_type = 1
|
||||
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.44529e-14, 8.41945e-08, 0.138072)
|
||||
body_offset = Transform3D(100, 1.71661e-05, 0, 0, -9.53674e-06, -100, -1.90735e-06, 100, -5.72205e-06, 0, 13.8072, -7.62939e-06)
|
||||
bone_name = "mixamorig_LeftForeArm"
|
||||
joint_constraints/bias = 0.3
|
||||
joint_constraints/damping = 1.0
|
||||
joint_constraints/impulse_clamp = 0.0
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Body/Armature/Skeleton3D/PhysicalBoneSimulator3D/Physical Bone mixamorig_LeftForeArm"]
|
||||
transform = Transform3D(0.01, 0, 0, 0, -4.37114e-10, 0.01, 0, -0.01, -4.37114e-10, 0, 0, 0)
|
||||
shape = SubResource("CapsuleShape3D_2k34c")
|
||||
|
||||
[node name="Physical Bone mixamorig_LeftHand" type="PhysicalBone3D" parent="Body/Armature/Skeleton3D/PhysicalBoneSimulator3D"]
|
||||
transform = Transform3D(9.11566, -98.6768, 13.4089, 23.9482, -10.8976, -96.4766, 96.6612, 12.0057, 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, -1.13621e-07, -6.28643e-08, 0.0264903)
|
||||
body_offset = Transform3D(-58.5197, 57.9894, 56.6804, 2.86102e-06, 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
|
||||
joint_constraints/damping = 1.0
|
||||
joint_constraints/impulse_clamp = 0.0
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Body/Armature/Skeleton3D/PhysicalBoneSimulator3D/Physical Bone mixamorig_LeftHand"]
|
||||
transform = Transform3D(0.01, 0, 0, 0, 0.00697578, 0.00716509, 0, -0.00716509, 0.00697578, 9.31323e-12, 0.0631712, -0.0648856)
|
||||
shape = SubResource("CapsuleShape3D_5fgdh")
|
||||
|
||||
[node name="Physical Bone mixamorig_RightArm" type="PhysicalBone3D" parent="Body/Armature/Skeleton3D/PhysicalBoneSimulator3D"]
|
||||
transform = Transform3D(30.7246, 72.8896, 61.1809, 93.7855, -34.0919, -6.48193, 16.1331, 59.3704, -78.8345, -27.5296, -1.29565, -110.13)
|
||||
collision_layer = 4
|
||||
collision_mask = 4
|
||||
joint_type = 1
|
||||
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -3.7896e-08, 1.38867e-07, 0.137023)
|
||||
body_offset = Transform3D(100, 1.14441e-05, 2.76566e-05, 5.72205e-06, 8.82149e-06, -100, 0, 100, 1.00136e-05, 0, 13.7023, -1.52588e-05)
|
||||
bone_name = "mixamorig_RightArm"
|
||||
joint_constraints/bias = 0.3
|
||||
joint_constraints/damping = 1.0
|
||||
joint_constraints/impulse_clamp = 0.0
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Body/Armature/Skeleton3D/PhysicalBoneSimulator3D/Physical Bone mixamorig_RightArm"]
|
||||
transform = Transform3D(0.01, 0, 0, 0, -4.37114e-10, 0.01, 0, -0.01, -4.37114e-10, 0, 0, 0)
|
||||
shape = SubResource("CapsuleShape3D_8vkyv")
|
||||
|
||||
[node name="Physical Bone mixamorig_RightForeArm" type="PhysicalBone3D" parent="Body/Armature/Skeleton3D/PhysicalBoneSimulator3D"]
|
||||
transform = Transform3D(24.3552, 37.4063, 89.4852, -25.0101, 91.5653, -31.4688, -93.7087, -14.716, 31.6563, -48.2682, 3.93748, -103.698)
|
||||
collision_layer = 4
|
||||
collision_mask = 4
|
||||
joint_type = 1
|
||||
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -7.36604e-08, 8.33694e-10, 0.138072)
|
||||
body_offset = Transform3D(100, 7.62939e-06, -1.90735e-06, -1.90735e-06, 100, 2.09808e-05, 9.53674e-07, 0, 100, 7.62939e-06, -2.98023e-06, -13.8072)
|
||||
bone_name = "mixamorig_RightForeArm"
|
||||
joint_constraints/bias = 0.3
|
||||
joint_constraints/damping = 1.0
|
||||
joint_constraints/impulse_clamp = 0.0
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Body/Armature/Skeleton3D/PhysicalBoneSimulator3D/Physical Bone mixamorig_RightForeArm"]
|
||||
transform = Transform3D(0.01, 0, 0, 0, 0.00999714, -0.000239087, 0, 0.000239087, 0.00999714, 2.23821e-15, 0.145694, 0.138911)
|
||||
shape = SubResource("CapsuleShape3D_fh1k4")
|
||||
|
||||
[node name="Physical Bone mixamorig_RightHand" type="PhysicalBone3D" parent="Body/Armature/Skeleton3D/PhysicalBoneSimulator3D"]
|
||||
transform = Transform3D(89.0767, -24.8074, -38.0781, 5.05125, 88.6727, -45.9526, 45.1645, 39.0096, 80.2397, -24.5746, 26.0951, -105.517)
|
||||
collision_layer = 4
|
||||
collision_mask = 4
|
||||
joint_type = 1
|
||||
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -9.49949e-08, 2.84053e-08, 0.0264903)
|
||||
body_offset = Transform3D(-58.5197, -57.9893, -56.6806, -2.86102e-06, 69.8991, -71.513, 81.0891, -41.8492, -40.9048, 1.50148, 1.8944, 1.08359)
|
||||
bone_name = "mixamorig_RightHand"
|
||||
joint_constraints/bias = 0.3
|
||||
joint_constraints/damping = 1.0
|
||||
joint_constraints/impulse_clamp = 0.0
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Body/Armature/Skeleton3D/PhysicalBoneSimulator3D/Physical Bone mixamorig_RightHand"]
|
||||
transform = Transform3D(0.01, 0, 0, 0, 0.00693402, 0.00720551, 0, -0.00720551, 0.00693402, -3.72529e-11, 0.0680192, -0.0706824)
|
||||
shape = SubResource("CapsuleShape3D_1m8r5")
|
||||
|
||||
[node name="Physical Bone mixamorig_LeftUpLeg" type="PhysicalBone3D" parent="Body/Armature/Skeleton3D/PhysicalBoneSimulator3D"]
|
||||
transform = Transform3D(-96.1773, -26.2684, 7.73902, -23.4203, 64.2554, -72.9571, 14.1919, -71.9807, -67.9513, 5.83706, 19.601, -60.9754)
|
||||
collision_layer = 4
|
||||
collision_mask = 4
|
||||
joint_type = 1
|
||||
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2.29454e-08, 7.74372e-09, 0.202997)
|
||||
body_offset = Transform3D(100, -3.8147e-06, -1.90735e-06, 1.90735e-06, 0, -100, 4.76837e-06, 100, -3.8147e-06, -1.90735e-06, 20.2997, 0)
|
||||
bone_name = "mixamorig_LeftUpLeg"
|
||||
joint_constraints/bias = 0.3
|
||||
joint_constraints/damping = 1.0
|
||||
joint_constraints/impulse_clamp = 0.0
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Body/Armature/Skeleton3D/PhysicalBoneSimulator3D/Physical Bone mixamorig_LeftUpLeg"]
|
||||
transform = Transform3D(0.01, 0, 0, 0, -4.37114e-10, 0.01, 0, -0.01, -4.37114e-10, 0, 0, 0)
|
||||
shape = SubResource("CapsuleShape3D_3cygo")
|
||||
|
||||
[node name="Physical Bone mixamorig_LeftLeg" type="PhysicalBone3D" parent="Body/Armature/Skeleton3D/PhysicalBoneSimulator3D"]
|
||||
transform = Transform3D(-97.5216, -11.6193, -18.8291, -22.0483, 58.1427, 78.3154, 1.84804, 80.5259, -59.2636, 8.22949, 17.9261, -34.7068)
|
||||
collision_layer = 4
|
||||
collision_mask = 4
|
||||
joint_type = 1
|
||||
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 9.53674e-09, 2.71032e-08, 0.210495)
|
||||
body_offset = Transform3D(100, 3.8147e-06, 0, 1.90735e-06, -3.8147e-06, -100, 1.90735e-06, 100, -3.8147e-06, -9.53674e-07, 21.0495, -1.90735e-06)
|
||||
bone_name = "mixamorig_LeftLeg"
|
||||
joint_constraints/bias = 0.3
|
||||
joint_constraints/damping = 1.0
|
||||
joint_constraints/impulse_clamp = 0.0
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Body/Armature/Skeleton3D/PhysicalBoneSimulator3D/Physical Bone mixamorig_LeftLeg"]
|
||||
transform = Transform3D(0.01, 0, 0, 0, -4.37114e-10, 0.01, 0, -0.01, -4.37114e-10, 0, 0, 0)
|
||||
shape = SubResource("CapsuleShape3D_vwdij")
|
||||
|
||||
[node name="Physical Bone mixamorig_LeftFoot" type="PhysicalBone3D" parent="Body/Armature/Skeleton3D/PhysicalBoneSimulator3D"]
|
||||
transform = Transform3D(-93.6712, -34.5296, 5.78096, -34.9451, 91.207, -21.4506, 2.13417, -22.1132, -97.501, 11.7385, 3.12729, -14.5678)
|
||||
collision_layer = 4
|
||||
collision_mask = 4
|
||||
joint_type = 1
|
||||
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.81149e-08, 1.07657e-08, 0.078608)
|
||||
body_offset = Transform3D(100, 0, -1.33514e-05, -8.58307e-06, -9.53674e-06, -100, -7.62939e-06, 100, -7.62939e-06, 2.86102e-06, 7.8608, -4.76837e-07)
|
||||
bone_name = "mixamorig_LeftFoot"
|
||||
joint_constraints/bias = 0.3
|
||||
joint_constraints/damping = 1.0
|
||||
joint_constraints/impulse_clamp = 0.0
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Body/Armature/Skeleton3D/PhysicalBoneSimulator3D/Physical Bone mixamorig_LeftFoot"]
|
||||
transform = Transform3D(0.01, 0, 0, 0, -4.37114e-10, 0.01, 0, -0.01, -4.37114e-10, 0, 0, 0)
|
||||
shape = SubResource("CapsuleShape3D_qyg6j")
|
||||
|
||||
[node name="Physical Bone mixamorig_RightUpLeg" type="PhysicalBone3D" parent="Body/Armature/Skeleton3D/PhysicalBoneSimulator3D"]
|
||||
transform = Transform3D(-83.6898, -51.5224, 18.4786, -50.5592, 59.8312, -62.161, 20.9709, -61.365, -76.122, -11.4062, 7.37459, -61.646)
|
||||
collision_layer = 4
|
||||
collision_mask = 4
|
||||
joint_type = 1
|
||||
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 3.24821e-08, -2.32312e-08, 0.202997)
|
||||
body_offset = Transform3D(100, -1.14441e-05, -1.90735e-06, 1.90735e-06, -3.8147e-06, -100, 5.72205e-06, 100, 1.14441e-05, -2.86102e-06, 20.2997, 0)
|
||||
bone_name = "mixamorig_RightUpLeg"
|
||||
joint_constraints/bias = 0.3
|
||||
joint_constraints/damping = 1.0
|
||||
joint_constraints/impulse_clamp = 0.0
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Body/Armature/Skeleton3D/PhysicalBoneSimulator3D/Physical Bone mixamorig_RightUpLeg"]
|
||||
transform = Transform3D(0.01, 0, 0, 0, -4.37114e-10, 0.01, 0, -0.01, -4.37114e-10, 0, 0, 0)
|
||||
shape = SubResource("CapsuleShape3D_a81km")
|
||||
|
||||
[node name="Physical Bone mixamorig_RightLeg" type="PhysicalBone3D" parent="Body/Armature/Skeleton3D/PhysicalBoneSimulator3D"]
|
||||
transform = Transform3D(-91.8175, -23.5087, -31.8887, -36.0103, 83.0805, 42.4368, 16.517, 50.4476, -84.748, -8.44487, 11.0604, -28.3544)
|
||||
collision_layer = 4
|
||||
collision_mask = 4
|
||||
joint_type = 1
|
||||
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 4.80548e-08, -2.71032e-08, 0.210495)
|
||||
body_offset = Transform3D(100, -1.14441e-05, -1.71661e-05, -9.53674e-07, 7.62939e-06, -100, 5.72205e-06, 100, 3.8147e-06, -1.19209e-06, 21.0495, 1.90735e-06)
|
||||
bone_name = "mixamorig_RightLeg"
|
||||
joint_constraints/bias = 0.3
|
||||
joint_constraints/damping = 1.0
|
||||
joint_constraints/impulse_clamp = 0.0
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Body/Armature/Skeleton3D/PhysicalBoneSimulator3D/Physical Bone mixamorig_RightLeg"]
|
||||
transform = Transform3D(0.01, 0, 0, 0, -4.37114e-10, 0.01, 0, -0.01, -4.37114e-10, 0, 0, 0)
|
||||
shape = SubResource("CapsuleShape3D_usdnr")
|
||||
|
||||
[node name="Physical Bone mixamorig_RightFoot" type="PhysicalBone3D" parent="Body/Armature/Skeleton3D/PhysicalBoneSimulator3D"]
|
||||
transform = Transform3D(-88.192, -17.3351, 43.8368, -46.855, 42.4443, -77.4796, -5.17504, -88.8706, -45.5548, -5.17837, 8.21816, -6.93437)
|
||||
collision_layer = 4
|
||||
collision_mask = 4
|
||||
joint_type = 1
|
||||
joint_offset = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2.14945e-08, -2.86102e-08, 0.078608)
|
||||
body_offset = Transform3D(100, -1.52588e-05, 7.62939e-06, -7.62939e-06, -1.90735e-05, -100, -1.90735e-06, 100, 0, 1.54972e-06, 7.8608, 2.86102e-06)
|
||||
bone_name = "mixamorig_RightFoot"
|
||||
joint_constraints/bias = 0.3
|
||||
joint_constraints/damping = 1.0
|
||||
joint_constraints/impulse_clamp = 0.0
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Body/Armature/Skeleton3D/PhysicalBoneSimulator3D/Physical Bone mixamorig_RightFoot"]
|
||||
transform = Transform3D(0.01, 0, 0, 0, -4.37114e-10, 0.01, 0, -0.01, -4.37114e-10, 0, 0, 0)
|
||||
shape = SubResource("CapsuleShape3D_p687f")
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="Body"]
|
||||
libraries = {
|
||||
|
@ -28,7 +28,6 @@ func _ready() -> void:
|
||||
|
||||
var bullet_amount: int = 0
|
||||
func spawn_bullet(position):
|
||||
print("spawning a bullet")
|
||||
var node: Node3D = ResourceLoader.load("res://scenes/weapon/bullet.tscn").instantiate()
|
||||
node.position = position.global_position
|
||||
node.transform.basis = position.global_transform.basis
|
||||
|
@ -12,7 +12,6 @@ func _process(delta: float) -> void:
|
||||
var root := get_tree().get_root()
|
||||
var id := multiplayer.get_unique_id()
|
||||
var player_data = GameServerManager.get_player_health.rpc_id(1, id)
|
||||
print(player_data)
|
||||
health_indicator.text = str(player_data["health"])
|
||||
|
||||
pass
|
||||
|
@ -13,7 +13,6 @@ func _ready() -> void:
|
||||
func _process(delta: float) -> void:
|
||||
var blue := $ChooseTeam/Blue
|
||||
var red := $ChooseTeam/Read
|
||||
if
|
||||
if raycast.is_colliding():
|
||||
var collider = raycast.get_collider()
|
||||
if collider and collider.name == target_node_name:
|
||||
|
@ -26,7 +26,6 @@ func _process(delta):
|
||||
if collider != null and collider.is_in_group("target"):
|
||||
ray.get_collider().take_damage()
|
||||
if collider != null and collider.is_in_group("body"):
|
||||
print(collider)
|
||||
ray.get_collider().hit()
|
||||
rigid_body_3d.visible = false
|
||||
particles.emitting = true
|
||||
|
@ -17,6 +17,7 @@ var mouse_captured: bool = false
|
||||
@onready var first_view_camera_mount: Node3D = $FirstPersonCameraMount
|
||||
@onready var first_view_camera: Camera3D = $FirstPersonCameraMount/Camera
|
||||
@onready var model_mount: Node3D = $ModelMount
|
||||
var model: Node3D = null
|
||||
|
||||
# -- This node is supposed to be spawned per player, and since each
|
||||
# -- player has an id, it is used for giving a node a name. So we can
|
||||
@ -42,33 +43,50 @@ func _ready() -> void:
|
||||
err = _add_legs_to_first_view()
|
||||
if err != OK:
|
||||
print("Error occured: " + str(err))
|
||||
var world_model := _add_world_model()
|
||||
if world_model == null:
|
||||
print("Error occured: " + "couldn't load the world model")
|
||||
|
||||
_enable_camera()
|
||||
else:
|
||||
var err := _add_world_model()
|
||||
if err != OK:
|
||||
print("Error occured: " + str(err))
|
||||
var world_model := _add_world_model()
|
||||
if world_model == null:
|
||||
print("Error occured: " + "couldn't load the world model")
|
||||
_hide_camera_mount()
|
||||
|
||||
_capture_mouse()
|
||||
|
||||
# -- Add a world model to the player, that should be seen by other players
|
||||
# -- on the server
|
||||
func _add_world_model() -> Error :
|
||||
func _add_world_model() -> Node3D :
|
||||
# -- TODO: It should not be hardcoded
|
||||
var path := "res://scenes/characters/blue/dummy.tscn"
|
||||
if not ResourceLoader.exists(path):
|
||||
return ERR_DOES_NOT_EXIST
|
||||
push_error(ERR_DOES_NOT_EXIST)
|
||||
return null
|
||||
var scene: PackedScene = ResourceLoader.load(path)
|
||||
if not scene.can_instantiate():
|
||||
return ERR_CANT_OPEN
|
||||
push_error(ERR_CANT_OPEN)
|
||||
return null
|
||||
var node: Node3D = scene.instantiate()
|
||||
model = node
|
||||
model_mount.add_child(node)
|
||||
return OK
|
||||
if _is_current_player():
|
||||
node.make_invisible()
|
||||
first_view_camera.cull_mask &= ~(1 << 1)
|
||||
return node
|
||||
|
||||
func _hide_camera_mount() :
|
||||
func _hide_camera_mount():
|
||||
first_view_camera_mount.visible = 0
|
||||
hud.visible = 0
|
||||
|
||||
|
||||
func make_node_invisible_for_camera(node: Node3D, camera: Camera3D):
|
||||
if node and camera:
|
||||
# Set the node to Layer 2 (or any other layer you want)
|
||||
node.visibility_layer = 1 << 1 # Assign the node to Layer 2
|
||||
# Disable Layer 2 on the camera's culling mask (this makes it invisible to this camera)
|
||||
camera.cull_mask &= ~(1 << 1) # Disable Layer 2 on this camera
|
||||
|
||||
var current_gun: String = "ak"
|
||||
@onready var gun_mount: Node3D = $FirstPersonCameraMount/GunMount
|
||||
@ -172,7 +190,11 @@ func _process(delta: float) -> void:
|
||||
health_indicator.text = str(health)
|
||||
fps_indicator.text = str(Engine.get_frames_per_second())
|
||||
if health == 0:
|
||||
alive = false
|
||||
model.reparent(get_tree().get_root())
|
||||
model.die()
|
||||
queue_free()
|
||||
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
# Add the gravity.
|
||||
@ -203,8 +225,8 @@ func _physics_process(delta: float) -> void:
|
||||
first_view_legs_anim.stop()
|
||||
velocity.x = move_toward(velocity.x, 0, SPEED)
|
||||
velocity.z = move_toward(velocity.z, 0, SPEED)
|
||||
|
||||
move_and_slide()
|
||||
if alive:
|
||||
move_and_slide()
|
||||
# -- TODO: It shouldn't be hardcoded
|
||||
var bullet = load("res://scenes/weapon/bullet.tscn")
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user