Skip to content

Commit b8a8670

Browse files
authored
Fix hitboxes not matching physical appearance in Squash the Creeps (#1019)
1 parent a69b2f7 commit b8a8670

File tree

3 files changed

+46
-7
lines changed

3 files changed

+46
-7
lines changed

3d/squash_the_creeps/Mob.tscn

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1-
[gd_scene load_steps=6 format=3 uid="uid://ha0ar5s2c3m4"]
1+
[gd_scene load_steps=7 format=3 uid="uid://ha0ar5s2c3m4"]
22

33
[ext_resource type="Script" path="res://Mob.gd" id="1"]
44
[ext_resource type="PackedScene" uid="uid://bicorb7we351t" path="res://art/mob.glb" id="2"]
55

66
[sub_resource type="BoxShape3D" id="1"]
77
size = Vector3(1.35822, 1.08835, 2.20058)
88

9+
[sub_resource type="BoxShape3D" id="BoxShape3D_vll1l"]
10+
size = Vector3(0.418579, 0.569824, 0.833984)
11+
912
[sub_resource type="Animation" id="2"]
1013
length = 1.2
1114
tracks/0/type = "value"
@@ -53,14 +56,30 @@ transform = Transform3D(1, 0, 0, 0, 0.996145, 0.0877225, 0, -0.0877225, 0.996145
5356
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.52793, 0)
5457
shape = SubResource("1")
5558

59+
[node name="CollisionShape2" type="CollisionShape3D" parent="."]
60+
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.861631, 0.783785, 0.180726)
61+
shape = SubResource("BoxShape3D_vll1l")
62+
63+
[node name="CollisionShape3" type="CollisionShape3D" parent="."]
64+
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.889494, 0.783785, 0.180726)
65+
shape = SubResource("BoxShape3D_vll1l")
66+
67+
[node name="CollisionShape4" type="CollisionShape3D" parent="."]
68+
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.889494, 0.783785, 1.43697)
69+
shape = SubResource("BoxShape3D_vll1l")
70+
71+
[node name="CollisionShape5" type="CollisionShape3D" parent="."]
72+
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.887008, 0.783785, 1.43697)
73+
shape = SubResource("BoxShape3D_vll1l")
74+
5675
[node name="VisibleOnScreenNotifier3D" type="VisibleOnScreenNotifier3D" parent="."]
5776
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.062134, 0.331645)
5877
aabb = AABB(-1.19986, 0.251327, -1.57098, 2.41047, 1.09305, 3.17223)
5978

6079
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
61-
autoplay = "float"
6280
libraries = {
6381
"": SubResource("AnimationLibrary_5n6vs")
6482
}
83+
autoplay = "float"
6584

6685
[connection signal="screen_exited" from="VisibleOnScreenNotifier3D" to="." method="_on_visible_on_screen_notifier_screen_exited"]

3d/squash_the_creeps/Player.gd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ func _physics_process(delta):
2727
# In the lines below, we turn the character when moving and make the animation play faster.
2828
direction = direction.normalized()
2929
# Setting the basis property will affect the rotation of the node.
30-
$Pivot.basis = Basis.looking_at(direction)
30+
basis = Basis.looking_at(direction)
3131
$AnimationPlayer.speed_scale = 4
3232
else:
3333
$AnimationPlayer.speed_scale = 1
@@ -62,7 +62,7 @@ func _physics_process(delta):
6262
break
6363

6464
# This makes the character follow a nice arc when jumping
65-
$Pivot.rotation.x = PI / 6 * velocity.y / jump_impulse
65+
rotation.x = PI / 6 * velocity.y / jump_impulse
6666

6767

6868
func die():

3d/squash_the_creeps/Player.tscn

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[gd_scene load_steps=7 format=3 uid="uid://dp478jyugrn7o"]
1+
[gd_scene load_steps=8 format=3 uid="uid://dp478jyugrn7o"]
22

33
[ext_resource type="Script" path="res://Player.gd" id="1"]
44
[ext_resource type="PackedScene" uid="uid://d0ypm0v45pwdv" path="res://art/player.glb" id="2"]
@@ -10,6 +10,10 @@ radius = 0.792278
1010
height = 0.1438
1111
radius = 0.907607
1212

13+
[sub_resource type="CylinderShape3D" id="CylinderShape3D_76fa1"]
14+
height = 0.144
15+
radius = 0.2
16+
1317
[sub_resource type="Animation" id="3"]
1418
length = 1.2
1519
tracks/0/type = "value"
@@ -49,7 +53,7 @@ script = ExtResource("1")
4953
[node name="Pivot" type="Node3D" parent="."]
5054

5155
[node name="Character" parent="Pivot" instance=ExtResource("2")]
52-
transform = Transform3D(1, 0, 0, 0, 0.996145, 0.0877225, 0, -0.0877225, 0.996145, 0, 0.329753, 0)
56+
transform = Transform3D(1, 0, 0, 0, 0.984808, 0.173648, 0, -0.173648, 0.984808, 0, 0.349734, 0)
5357

5458
[node name="CollisionShape" type="CollisionShape3D" parent="."]
5559
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.771765, 0)
@@ -64,10 +68,26 @@ monitorable = false
6468
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.06491, 0)
6569
shape = SubResource("2")
6670

71+
[node name="CollisionShape2" type="CollisionShape3D" parent="MobDetector"]
72+
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.455268, 0.95, 1.1423)
73+
shape = SubResource("CylinderShape3D_76fa1")
74+
75+
[node name="CollisionShape3" type="CollisionShape3D" parent="MobDetector"]
76+
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.716365, 0.95, 1.71889)
77+
shape = SubResource("CylinderShape3D_76fa1")
78+
79+
[node name="CollisionShape4" type="CollisionShape3D" parent="MobDetector"]
80+
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.730546, 0.95, 1.69713)
81+
shape = SubResource("CylinderShape3D_76fa1")
82+
83+
[node name="CollisionShape5" type="CollisionShape3D" parent="MobDetector"]
84+
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.45857, 0.95, 1.15318)
85+
shape = SubResource("CylinderShape3D_76fa1")
86+
6787
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
68-
autoplay = "float"
6988
libraries = {
7089
"": SubResource("AnimationLibrary_aq6tr")
7190
}
91+
autoplay = "float"
7292

7393
[connection signal="body_entered" from="MobDetector" to="." method="_on_MobDetector_body_entered"]

0 commit comments

Comments
 (0)