Ball reports most upward normal

This commit is contained in:
Rob Kelly 2024-11-20 22:04:35 -07:00
parent 1c5222fecf
commit fbbc58ae83
4 changed files with 23 additions and 11 deletions

View File

@ -341,16 +341,16 @@ transform = Transform3D(-0.734269, 0.305072, -0.606448, 0, 0.893336, 0.44939, 0.
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 129.404, -9.53674e-07, 309.4)
[node name="ConcreteBuilding1" parent="CityBuildings" instance=ExtResource("10_lf15j")]
transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, 0, 0, 0)
transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, 0, -0.01, 0)
[node name="KanaSignboard" parent="CityBuildings/ConcreteBuilding1" instance=ExtResource("11_evxup")]
transform = Transform3D(-8.74228e-08, 0, -2, 0, 2, 0, 2, 0, -8.74228e-08, 10.8, 12, 7)
[node name="ConcreteBuilding2" parent="CityBuildings" instance=ExtResource("10_lf15j")]
transform = Transform3D(-4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, 0, 0, 20)
transform = Transform3D(-4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, 0, -0.01, 20)
[node name="ConcreteBuilding3" parent="CityBuildings" instance=ExtResource("10_lf15j")]
transform = Transform3D(-4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, 0, 0, 40)
transform = Transform3D(-4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, 0, -0.01, 40)
[node name="PalmTree" parent="CityBuildings" instance=ExtResource("12_sswxf")]
transform = Transform3D(-0.69799, 0, -0.716107, 0, 1, 0, 0.716107, 0, -0.69799, 11.468, 0, -12.468)
@ -370,7 +370,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 137.181, -20, -7.285)
curve = SubResource("Curve3D_5n8tb")
[node name="ConcreteBuilding1" parent="MountainCurve" instance=ExtResource("10_lf15j")]
transform = Transform3D(-0.0979477, 0, 0.995192, 0, 1, 0, -0.995192, 0, -0.0979477, -10.074, 0, -32.347)
transform = Transform3D(-0.0979477, 0, 0.995192, 0, 1, 0, -0.995192, 0, -0.0979477, -10.074, -0.01, -32.347)
[node name="GuardRail" parent="MountainCurve" instance=ExtResource("16_xtxyj")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 70.2122, 0, 116.269)

View File

@ -68,7 +68,15 @@ func _integrate_forces(state: PhysicsDirectBodyState3D) -> void:
var damping := air_damping
if state.get_contact_count():
_last_contact_normal = state.get_contact_local_normal(0)
# We want the contact normal which minimizes the angle to the up vector
var min_dot := -1.0
for i: int in range(state.get_contact_count()):
var norm := state.get_contact_local_normal(i)
var dot := norm.dot(Vector3.UP)
if dot > min_dot:
min_dot = dot
_last_contact_normal = norm
damping = _total_terrain_angular_damping()
if damping <= TERRAIN_DAMPING_EPSILON:
damping = rough_damping

View File

@ -63,7 +63,7 @@ physics_material_override = ExtResource("1_l23pw")
freeze = true
continuous_cd = true
contact_monitor = true
max_contacts_reported = 1
max_contacts_reported = 3
linear_damp_mode = 1
angular_damp_mode = 1
angular_damp = 8.0

View File

@ -44,11 +44,15 @@ texture = SubResource("GradientTexture2D_tm61r")
unique_name_in_owner = true
custom_minimum_size = Vector2(120, 0)
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
offset_top = 50.0
offset_bottom = 50.0
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -120.0
offset_top = 18.0
offset_right = 120.0
offset_bottom = 146.0
grow_horizontal = 2
grow_vertical = 2
theme_override_constants/separation = 5