diff --git a/2d/physics_tests/README.md b/2d/physics_tests/README.md index 7e966915..ec9333c1 100644 --- a/2d/physics_tests/README.md +++ b/2d/physics_tests/README.md @@ -12,10 +12,10 @@ They can be used for different purpose: Language: GDScript -Renderer: Compatibility +Renderer: Mobile Check out this demo on the asset library: https://godotengine.org/asset-library/asset/2726 ## Screenshots -![Screenshot](screenshots/screenshot.png) +![Screenshot](screenshots/physics_tests.webp) diff --git a/2d/physics_tests/assets/tileset/tileset.tres b/2d/physics_tests/assets/tileset/tileset.tres index ebb44481..4c94c130 100644 --- a/2d/physics_tests/assets/tileset/tileset.tres +++ b/2d/physics_tests/assets/tileset/tileset.tres @@ -7,12 +7,8 @@ texture = ExtResource("1") 0:0/next_alternative_id = 8 0:0/0 = 0 0:0/0/modulate = Color(0, 0, 1, 1) -0:0/0/physics_layer_0/linear_velocity = Vector2(0, 0) -0:0/0/physics_layer_0/angular_velocity = 0.0 0:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8) 1:0/0 = 0 -1:0/0/physics_layer_0/linear_velocity = Vector2(0, 0) -1:0/0/physics_layer_0/angular_velocity = 0.0 1:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8) 1:0/0/physics_layer_0/polygon_0/one_way = true diff --git a/2d/physics_tests/main.tscn b/2d/physics_tests/main.tscn index 05264ac7..c0bf4da5 100644 --- a/2d/physics_tests/main.tscn +++ b/2d/physics_tests/main.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=11 format=3 uid="uid://6a0nxwkgf5dq"] +[gd_scene load_steps=15 format=3 uid="uid://6a0nxwkgf5dq"] [ext_resource type="Script" uid="uid://db4ofia8ieq55" path="res://utils/label_fps.gd" id="1"] [ext_resource type="Script" uid="uid://dustsplck84ac" path="res://utils/label_version.gd" id="2"] @@ -6,8 +6,12 @@ [ext_resource type="Script" uid="uid://cw0pi4lgucxdr" path="res://tests_menu.gd" id="4"] [ext_resource type="Script" uid="uid://bjl0grl2gv43y" path="res://utils/label_test.gd" id="5"] [ext_resource type="Script" uid="uid://b4rnndt2dw5g1" path="res://utils/label_pause.gd" id="6"] +[ext_resource type="Script" uid="uid://7kql0xtuc7ny" path="res://utils/ticks_per_second.gd" id="8_dg77c"] +[ext_resource type="Script" uid="uid://beqnv31yip0bl" path="res://utils/time_scale.gd" id="9_ycdy4"] [ext_resource type="Script" uid="uid://k8crlob60yte" path="res://utils/container_log.gd" id="10"] +[ext_resource type="Script" uid="uid://cvoeuonqmsye1" path="res://utils/max_steps_per_frame.gd" id="10_w48qg"] [ext_resource type="Script" uid="uid://b2t0e1okrl3j4" path="res://utils/scroll_log.gd" id="11"] +[ext_resource type="Script" uid="uid://ijebwwx4t8et" path="res://utils/physics_interpolation.gd" id="11_ycdy4"] [ext_resource type="Script" uid="uid://db80201lynb6l" path="res://tests.gd" id="12"] [sub_resource type="StyleBoxFlat" id="1"] @@ -29,7 +33,7 @@ offset_left = 10.0 offset_top = 10.0 offset_right = 125.0 offset_bottom = 30.0 -text = "TESTS" +text = "Tests" flat = false script = ExtResource("4") @@ -39,7 +43,8 @@ offset_left = 157.0 offset_top = 13.0 offset_right = 646.0 offset_bottom = 27.0 -text = "P - TOGGLE PAUSE / R - RESTART / C - TOGGLE COLLISION / F - TOGGLE FULL SCREEN / ESC - QUIT" +theme_override_constants/outline_size = 4 +text = "P: Toggle Pause | R: Restart | C: Toggle Collision | F: Toggle Fullscreen | ESC: Quit" [node name="LabelFPS" type="Label" parent="."] layout_mode = 1 @@ -47,9 +52,9 @@ anchors_preset = 2 anchor_top = 1.0 anchor_bottom = 1.0 offset_left = 10.0 -offset_top = -19.0 -offset_right = 50.0 -offset_bottom = -5.0 +offset_top = -36.0 +offset_right = 55.0 +offset_bottom = -13.0 grow_vertical = 0 theme_override_colors/font_outline_color = Color(0, 0, 0, 1) theme_override_constants/outline_size = 4 @@ -62,10 +67,11 @@ anchors_preset = 2 anchor_top = 1.0 anchor_bottom = 1.0 offset_left = 10.0 -offset_top = -56.0 +offset_top = -64.0 offset_right = 128.0 -offset_bottom = -33.0 +offset_bottom = -41.0 grow_vertical = 0 +theme_override_colors/font_color = Color(1, 1, 1, 0.752941) theme_override_colors/font_outline_color = Color(0, 0, 0, 1) theme_override_constants/outline_size = 4 text = "Physics engine:" @@ -77,13 +83,14 @@ anchors_preset = 2 anchor_top = 1.0 anchor_bottom = 1.0 offset_left = 10.0 -offset_top = -84.0 +offset_top = -92.0 offset_right = 125.0 -offset_bottom = -61.0 +offset_bottom = -69.0 grow_vertical = 0 +theme_override_colors/font_color = Color(1, 1, 1, 0.752941) theme_override_colors/font_outline_color = Color(0, 0, 0, 1) theme_override_constants/outline_size = 4 -text = "Godot Version:" +text = "Godot version:" script = ExtResource("2") [node name="LabelTest" type="Label" parent="."] @@ -92,9 +99,9 @@ anchors_preset = 2 anchor_top = 1.0 anchor_bottom = 1.0 offset_left = 10.0 -offset_top = -112.0 +offset_top = -120.0 offset_right = 50.0 -offset_bottom = -89.0 +offset_bottom = -97.0 grow_vertical = 0 theme_override_colors/font_outline_color = Color(0, 0, 0, 1) theme_override_constants/outline_size = 4 @@ -112,10 +119,122 @@ offset_top = 48.0 offset_right = 62.0 offset_bottom = 96.0 grow_horizontal = 2 -theme_override_font_sizes/font_size = 32 -text = "PAUSED" +theme_override_constants/outline_size = 6 +theme_override_font_sizes/font_size = 24 +text = "Paused" script = ExtResource("6") +[node name="Options" type="VBoxContainer" parent="."] +layout_mode = 1 +anchors_preset = 1 +anchor_left = 1.0 +anchor_right = 1.0 +offset_left = -392.0 +offset_top = 56.0 +offset_right = -16.0 +offset_bottom = 168.0 +grow_horizontal = 0 +theme_override_constants/separation = 6 + +[node name="TicksPerSecond" type="HBoxContainer" parent="Options"] +layout_mode = 2 +tooltip_text = "Higher values make physics more precise at the cost of higher CPU utilization. +Low values may result in objects phasing through each other (tunneling). +Physics ticks per second are automatically multiplied by Time Scale in this project." +theme_override_constants/separation = 10 +script = ExtResource("8_dg77c") + +[node name="Label" type="Label" parent="Options/TicksPerSecond"] +custom_minimum_size = Vector2(164, 0) +layout_mode = 2 +theme_override_colors/font_outline_color = Color(0, 0, 0, 1) +theme_override_constants/outline_size = 4 +text = "Ticks per Second" + +[node name="HSlider" type="HSlider" parent="Options/TicksPerSecond"] +custom_minimum_size = Vector2(160, 0) +layout_mode = 2 +size_flags_vertical = 4 +min_value = 10.0 +max_value = 240.0 +step = 10.0 +value = 60.0 + +[node name="Value" type="Label" parent="Options/TicksPerSecond"] +layout_mode = 2 +theme_override_colors/font_outline_color = Color(0, 0, 0, 1) +theme_override_constants/outline_size = 4 +text = "60" + +[node name="TimeScale" type="HBoxContainer" parent="Options"] +layout_mode = 2 +tooltip_text = "Game speed multiplier. Physics ticks per second are +automatically multiplied by Time Scale in this project +to ensure accurate simulation regardless of time scale." +theme_override_constants/separation = 10 +script = ExtResource("9_ycdy4") + +[node name="Label" type="Label" parent="Options/TimeScale"] +custom_minimum_size = Vector2(164, 0) +layout_mode = 2 +theme_override_colors/font_outline_color = Color(0, 0, 0, 1) +theme_override_constants/outline_size = 4 +text = "Time Scale" + +[node name="HSlider" type="HSlider" parent="Options/TimeScale"] +custom_minimum_size = Vector2(160, 0) +layout_mode = 2 +size_flags_vertical = 4 +max_value = 5.0 +step = 0.5 +value = 0.5 + +[node name="Value" type="Label" parent="Options/TimeScale"] +layout_mode = 2 +theme_override_colors/font_outline_color = Color(0, 0, 0, 1) +theme_override_constants/outline_size = 4 +text = "1.0×" + +[node name="MaxStepsPerFrame" type="HBoxContainer" parent="Options"] +layout_mode = 2 +tooltip_text = "Physics will slow down if more physics steps +than this value need to be simulated in a +single rendered frame." +theme_override_constants/separation = 10 +script = ExtResource("10_w48qg") + +[node name="Label" type="Label" parent="Options/MaxStepsPerFrame"] +custom_minimum_size = Vector2(164, 0) +layout_mode = 2 +theme_override_colors/font_outline_color = Color(0, 0, 0, 1) +theme_override_constants/outline_size = 4 +text = "Max Steps per Frame" + +[node name="HSlider" type="HSlider" parent="Options/MaxStepsPerFrame"] +custom_minimum_size = Vector2(160, 0) +layout_mode = 2 +size_flags_vertical = 4 +min_value = 1.0 +max_value = 20.0 +value = 8.0 + +[node name="Value" type="Label" parent="Options/MaxStepsPerFrame"] +layout_mode = 2 +theme_override_colors/font_outline_color = Color(0, 0, 0, 1) +theme_override_constants/outline_size = 4 +text = "8" + +[node name="PhysicsInterpolation" type="CheckButton" parent="Options"] +custom_minimum_size = Vector2(217, 0) +layout_mode = 2 +size_flags_horizontal = 0 +tooltip_text = "Smooths out rendering regardless of the physics tick rate. +This is a purely visual effect and has no impact on the physics simulation." +theme_override_constants/outline_size = 4 +button_pressed = true +text = "Physics Interpolation" +script = ExtResource("11_ycdy4") + [node name="PanelLog" type="Panel" parent="."] layout_mode = 1 anchors_preset = 3 @@ -127,6 +246,7 @@ offset_left = -630.0 offset_top = -251.0 grow_horizontal = 0 grow_vertical = 0 +mouse_filter = 1 theme_override_styles/panel = SubResource("1") [node name="ButtonClear" type="Button" parent="PanelLog"] @@ -136,8 +256,8 @@ anchor_left = 1.0 anchor_top = 1.0 anchor_right = 1.0 anchor_bottom = 1.0 -offset_left = -48.0 -offset_top = -25.0 +offset_left = -65.0 +offset_top = -36.0 offset_right = -5.0 offset_bottom = -5.0 grow_horizontal = 0 @@ -152,13 +272,14 @@ anchor_left = 1.0 anchor_top = 1.0 anchor_right = 1.0 anchor_bottom = 1.0 -offset_left = -261.0 +offset_left = -269.0 offset_top = -35.0 -offset_right = -62.0 +offset_right = -70.0 offset_bottom = -4.0 grow_horizontal = 0 grow_vertical = 0 focus_mode = 0 +button_pressed = true text = "Automatic Scrolling" [node name="ScrollLog" type="ScrollContainer" parent="PanelLog"] @@ -182,5 +303,9 @@ layout_mode = 2 text = "Log start" max_lines_visible = 5 +[connection signal="value_changed" from="Options/TicksPerSecond/HSlider" to="Options/TicksPerSecond" method="_on_h_slider_value_changed"] +[connection signal="value_changed" from="Options/TimeScale/HSlider" to="Options/TimeScale" method="_on_h_slider_value_changed"] +[connection signal="value_changed" from="Options/MaxStepsPerFrame/HSlider" to="Options/MaxStepsPerFrame" method="_on_h_slider_value_changed"] +[connection signal="toggled" from="Options/PhysicsInterpolation" to="Options/PhysicsInterpolation" method="_on_check_button_toggled"] [connection signal="pressed" from="PanelLog/ButtonClear" to="PanelLog/ScrollLog/VBoxLog" method="clear"] [connection signal="toggled" from="PanelLog/CheckBoxScroll" to="PanelLog/ScrollLog" method="_on_check_box_scroll_toggled"] diff --git a/2d/physics_tests/project.godot b/2d/physics_tests/project.godot index 8aa226a6..e1d8fcb2 100644 --- a/2d/physics_tests/project.godot +++ b/2d/physics_tests/project.godot @@ -24,6 +24,7 @@ System="*res://utils/system.gd" [debug] gdscript/warnings/untyped_declaration=1 +shapes/collision/shape_color=Color(0, 0.533333, 1, 1) [display] @@ -103,5 +104,5 @@ common/physics_interpolation=true [rendering] -renderer/rendering_method="gl_compatibility" -renderer/rendering_method.mobile="gl_compatibility" +renderer/rendering_method="mobile" +anti_aliasing/quality/msaa_2d=2 diff --git a/2d/physics_tests/screenshots/physics_tests.webp b/2d/physics_tests/screenshots/physics_tests.webp new file mode 100644 index 00000000..bfbbac57 Binary files /dev/null and b/2d/physics_tests/screenshots/physics_tests.webp differ diff --git a/2d/physics_tests/screenshots/screenshot.png b/2d/physics_tests/screenshots/screenshot.png deleted file mode 100644 index 80b94631..00000000 Binary files a/2d/physics_tests/screenshots/screenshot.png and /dev/null differ diff --git a/2d/physics_tests/test.gd b/2d/physics_tests/test.gd index 545c396e..f682f9f8 100644 --- a/2d/physics_tests/test.gd +++ b/2d/physics_tests/test.gd @@ -55,7 +55,7 @@ func add_shape(shape: Shape2D, shape_transform: Transform2D, color: Color) -> vo var collision := CollisionShape2D.new() collision.shape = shape collision.transform = shape_transform - collision.modulate = color + collision.debug_color = color * Color(1, 1, 1, 0.1) _drawn_nodes.push_back(collision) add_child(collision) @@ -70,6 +70,7 @@ func create_rigidbody(shape: Shape2D, pickable: bool = false, shape_transform: T var collision := CollisionShape2D.new() collision.shape = shape collision.transform = shape_transform + collision.debug_color = Color.YELLOW * Color(1, 1, 1, 0.1) var body := RigidBody2D.new() body.add_child(collision) diff --git a/2d/physics_tests/tests/dynamic_box.tscn b/2d/physics_tests/tests/dynamic_box.tscn index e1f013c4..f483057b 100644 --- a/2d/physics_tests/tests/dynamic_box.tscn +++ b/2d/physics_tests/tests/dynamic_box.tscn @@ -3,8 +3,9 @@ [sub_resource type="RectangleShape2D" id="1"] size = Vector2(40, 40) -[node name="StackBox" type="RigidDynamicBody2D"] +[node name="StackBox" type="RigidBody2D"] position = Vector2(-180, -20) [node name="CollisionShape2D" type="CollisionShape2D" parent="."] shape = SubResource("1") +debug_color = Color(1, 1, 0, 0.0980392) diff --git a/2d/physics_tests/tests/functional/test_character_pixels.tscn b/2d/physics_tests/tests/functional/test_character_pixels.tscn index e400bb57..56903e08 100644 --- a/2d/physics_tests/tests/functional/test_character_pixels.tscn +++ b/2d/physics_tests/tests/functional/test_character_pixels.tscn @@ -32,6 +32,7 @@ _jump_force = 50.0 _snap_distance = 1.0 [node name="ViewportContainer" type="SubViewportContainer" parent="."] +anchors_preset = 15 anchor_right = 1.0 anchor_bottom = 1.0 offset_right = 1024.0 @@ -39,9 +40,6 @@ offset_bottom = 600.0 size_flags_horizontal = 3 size_flags_vertical = 3 stretch = true -__meta__ = { -"_edit_use_anchors_": false -} [node name="Viewport" type="SubViewport" parent="ViewportContainer"] handle_input_locally = false @@ -60,6 +58,7 @@ script = ExtResource("7") [node name="CollisionShape2D" type="CollisionShape2D" parent="ViewportContainer/Viewport/CharacterBody2D"] shape = SubResource("3") +debug_color = Color(0, 1, 0, 0.0980392) [node name="CharacterBodyRay2D" type="CharacterBody2D" parent="ViewportContainer/Viewport"] position = Vector2(30, 40) @@ -69,66 +68,63 @@ script = ExtResource("7") [node name="CollisionShape2D" type="CollisionShape2D" parent="ViewportContainer/Viewport/CharacterBodyRay2D"] position = Vector2(0, -2.5) shape = SubResource("RectangleShape2D_scs3g") +debug_color = Color(0, 1, 0, 0.0980392) [node name="CollisionShapeRay2D" type="CollisionShape2D" parent="ViewportContainer/Viewport/CharacterBodyRay2D"] position = Vector2(0, -2) shape = SubResource("SeparationRayShape2D_vby12") +debug_color = Color(0, 1, 0, 0.0980392) -[node name="RigidDynamicBody2D" type="RigidDynamicBody2D" parent="ViewportContainer/Viewport"] +[node name="RigidDynamicBody2D" type="RigidBody2D" parent="ViewportContainer/Viewport"] position = Vector2(30, 40) collision_mask = 2147483649 physics_material_override = SubResource("1") -contacts_reported = 4 -contact_monitor = true lock_rotation = true +contact_monitor = true script = ExtResource("2") [node name="CollisionShape2D" type="CollisionShape2D" parent="ViewportContainer/Viewport/RigidDynamicBody2D"] shape = SubResource("2") +debug_color = Color(1, 1, 0, 0.0980392) -[node name="RigidBodyRay2D" type="RigidDynamicBody2D" parent="ViewportContainer/Viewport"] +[node name="RigidBodyRay2D" type="RigidBody2D" parent="ViewportContainer/Viewport"] position = Vector2(30, 40) collision_mask = 2147483649 physics_material_override = SubResource("1") -contacts_reported = 4 -contact_monitor = true lock_rotation = true +contact_monitor = true script = ExtResource("2") [node name="CollisionShape2D" type="CollisionShape2D" parent="ViewportContainer/Viewport/RigidBodyRay2D"] position = Vector2(0, -2.5) shape = SubResource("RectangleShape2D_scs3g") +debug_color = Color(1, 1, 0, 0.0980392) [node name="CollisionShapeRay2D" type="CollisionShape2D" parent="ViewportContainer/Viewport/RigidBodyRay2D"] position = Vector2(0, -2) shape = SubResource("SeparationRayShape2D_vby12") +debug_color = Color(1, 1, 0, 0.0980392) [node name="Wall1" type="StaticBody2D" parent="ViewportContainer/Viewport"] position = Vector2(20, 40) -[node name="CollisionShape2D" type="CollisionShape2D" parent="SubViewportContainer/SubViewport/Wall1"] -rotation = 1.5708 -shape = SubResource("6") - [node name="Wall2" type="StaticBody2D" parent="ViewportContainer/Viewport"] position = Vector2(122, 40) -[node name="CollisionShape2D" type="CollisionShape2D" parent="SubViewportContainer/SubViewport/Wall2"] -rotation = 1.5708 -shape = SubResource("6") - [node name="Platform1" type="StaticBody2D" parent="ViewportContainer/Viewport"] position = Vector2(50, 44) [node name="CollisionShape2D" type="CollisionShape2D" parent="ViewportContainer/Viewport/Platform1"] shape = SubResource("6") one_way_collision = true +debug_color = Color(0, 0.533333, 1, 0.0980392) [node name="Platform2" type="StaticBody2D" parent="ViewportContainer/Viewport"] position = Vector2(80, 38) [node name="CollisionShape2D" type="CollisionShape2D" parent="ViewportContainer/Viewport/Platform2"] shape = SubResource("6") +debug_color = Color(0, 0.533333, 1, 0.0980392) [node name="Slope" type="StaticBody2D" parent="ViewportContainer/Viewport"] position = Vector2(85, 36) @@ -136,15 +132,22 @@ position = Vector2(85, 36) [node name="CollisionShape2D" type="CollisionPolygon2D" parent="ViewportContainer/Viewport/Slope"] polygon = PackedVector2Array(0, 0, 6, 0, 22, 16, 16, 16) +[node name="SubViewportContainer_SubViewport_Wall1#CollisionShape2D" type="CollisionShape2D" parent="."] +rotation = 1.5708 +shape = SubResource("6") +debug_color = Color(0, 0.6, 0.7, 0.42) + +[node name="SubViewportContainer_SubViewport_Wall2#CollisionShape2D" type="CollisionShape2D" parent="."] +rotation = 1.5708 +shape = SubResource("6") +debug_color = Color(0, 0.6, 0.7, 0.42) + [node name="LabelTestType" type="Label" parent="."] offset_left = 14.0 offset_top = 79.0 offset_right = 145.0 offset_bottom = 93.0 text = "Testing: " -__meta__ = { -"_edit_use_anchors_": false -} [node name="Options" parent="." instance=ExtResource("3")] @@ -154,9 +157,6 @@ offset_top = 237.929 offset_right = 145.0 offset_bottom = 251.929 text = "ON FLOOR" -__meta__ = { -"_edit_use_anchors_": false -} [node name="LabelControls" type="Label" parent="."] offset_left = 14.0 @@ -165,6 +165,3 @@ offset_right = 145.0 offset_bottom = 294.291 text = "LEFT/RIGHT - MOVE UP - JUMP" -__meta__ = { -"_edit_use_anchors_": false -} diff --git a/2d/physics_tests/tests/functional/test_character_slopes.tscn b/2d/physics_tests/tests/functional/test_character_slopes.tscn index f371dfc2..2628b698 100644 --- a/2d/physics_tests/tests/functional/test_character_slopes.tscn +++ b/2d/physics_tests/tests/functional/test_character_slopes.tscn @@ -70,15 +70,10 @@ alignment = 2 [node name="Label" type="Label" parent="FloorMaxAngle"] layout_mode = 2 -offset_right = 123.0 -offset_bottom = 26.0 text = "Floor Max angle" [node name="HSlider" type="HSlider" parent="FloorMaxAngle"] layout_mode = 2 -offset_left = 143.0 -offset_right = 419.0 -offset_bottom = 16.0 size_flags_horizontal = 3 max_value = 180.0 script = ExtResource("3_cd5g0") @@ -86,9 +81,6 @@ snap_step = 5.0 [node name="LabelValue" type="Label" parent="FloorMaxAngle"] layout_mode = 2 -offset_left = 439.0 -offset_right = 462.0 -offset_bottom = 26.0 text = "0.0" script = ExtResource("4_eoplu") @@ -99,6 +91,7 @@ script = ExtResource("7") [node name="CollisionShape2D" type="CollisionShape2D" parent="CharacterBody2D"] shape = SubResource("3") +debug_color = Color(0, 1, 0, 0.0980392) [node name="CharacterBodyRay2D" type="CharacterBody2D" parent="."] position = Vector2(100, 450) @@ -108,37 +101,42 @@ script = ExtResource("7") [node name="CollisionShape2D" type="CollisionShape2D" parent="CharacterBodyRay2D"] position = Vector2(0, -16) shape = SubResource("CircleShape2D_llvur") +debug_color = Color(0, 1, 0, 0.0980392) [node name="CollisionShapeRay2D" type="CollisionShape2D" parent="CharacterBodyRay2D"] position = Vector2(0, -16) shape = SubResource("RayShape2D_3lv1w") +debug_color = Color(0, 1, 0, 0.0980392) [node name="RigidDynamicBody2D" type="RigidBody2D" parent="."] position = Vector2(100, 450) collision_mask = 2147483649 physics_material_override = SubResource("1") -contact_monitor = true lock_rotation = true +contact_monitor = true script = ExtResource("6") [node name="CollisionShape2D" type="CollisionShape2D" parent="RigidDynamicBody2D"] shape = SubResource("2") +debug_color = Color(1, 1, 0, 0.0980392) [node name="RigidBodyRay2D" type="RigidBody2D" parent="."] position = Vector2(100, 450) collision_mask = 2147483649 physics_material_override = SubResource("1") -contact_monitor = true lock_rotation = true +contact_monitor = true script = ExtResource("6") [node name="CollisionShape2D" type="CollisionShape2D" parent="RigidBodyRay2D"] position = Vector2(-7.62939e-06, -16) shape = SubResource("CircleShape2D_dr08f") +debug_color = Color(1, 1, 0, 0.0980392) [node name="CollisionShapeRay2D" type="CollisionShape2D" parent="RigidBodyRay2D"] position = Vector2(-7.62939e-06, -16) shape = SubResource("RayShape2D_w83f0") +debug_color = Color(1, 1, 0, 0.0980392) [node name="StaticSceneFlat" parent="." instance=ExtResource("4")] position = Vector2(0, 12) diff --git a/2d/physics_tests/tests/functional/test_character_tilemap.tscn b/2d/physics_tests/tests/functional/test_character_tilemap.tscn index 5b5f743f..9ae69f5b 100644 --- a/2d/physics_tests/tests/functional/test_character_tilemap.tscn +++ b/2d/physics_tests/tests/functional/test_character_tilemap.tscn @@ -56,6 +56,7 @@ script = ExtResource("7") [node name="CollisionShape2D" type="CollisionShape2D" parent="CharacterBody2D"] shape = SubResource("2") +debug_color = Color(0, 1, 0, 0.0980392) [node name="CharacterBodyRay2D" type="CharacterBody2D" parent="."] position = Vector2(250, 460) @@ -65,18 +66,22 @@ script = ExtResource("7") [node name="CollisionShape2D" type="CollisionShape2D" parent="CharacterBodyRay2D"] position = Vector2(0, -8) shape = SubResource("RectangleShape2D_jx2e1") +debug_color = Color(0, 1, 0, 0.0980392) [node name="CollisionShapeRay2D" type="CollisionShape2D" parent="CharacterBodyRay2D"] position = Vector2(0, 8) shape = SubResource("RayShape2D_206f5") +debug_color = Color(0, 1, 0, 0.0980392) [node name="CollisionShapeRay2DLeft" type="CollisionShape2D" parent="CharacterBodyRay2D"] position = Vector2(-12, 8) shape = SubResource("RayShape2D_206f5") +debug_color = Color(0, 1, 0, 0.0980392) [node name="CollisionShapeRay2DRight" type="CollisionShape2D" parent="CharacterBodyRay2D"] position = Vector2(12, 8) shape = SubResource("RayShape2D_206f5") +debug_color = Color(0, 1, 0, 0.0980392) [node name="RigidDynamicBody2D" type="RigidBody2D" parent="."] position = Vector2(250, 460) @@ -88,6 +93,7 @@ script = ExtResource("6") [node name="CollisionShape2D" type="CollisionShape2D" parent="RigidDynamicBody2D"] shape = SubResource("2") +debug_color = Color(1, 1, 0, 0.0980392) [node name="RigidBodyRay2D" type="RigidBody2D" parent="."] position = Vector2(250, 460) @@ -100,18 +106,22 @@ script = ExtResource("6") [node name="CollisionShape2D" type="CollisionShape2D" parent="RigidBodyRay2D"] position = Vector2(0, -8) shape = SubResource("RectangleShape2D_jx2e1") +debug_color = Color(1, 1, 0, 0.0980392) [node name="CollisionShapeRay2D" type="CollisionShape2D" parent="RigidBodyRay2D"] position = Vector2(0, 8) shape = SubResource("RayShape2D_206f5") +debug_color = Color(1, 1, 0, 0.0980392) [node name="CollisionShapeRay2DLeft" type="CollisionShape2D" parent="RigidBodyRay2D"] position = Vector2(-12, 8) shape = SubResource("RayShape2D_206f5") +debug_color = Color(1, 1, 0, 0.0980392) [node name="CollisionShapeRay2DRight" type="CollisionShape2D" parent="RigidBodyRay2D"] position = Vector2(12, 8) shape = SubResource("RayShape2D_206f5") +debug_color = Color(1, 1, 0, 0.0980392) [node name="JumpTargetArea2D" type="Area2D" parent="."] visible = false @@ -120,6 +130,7 @@ position = Vector2(810, 390) [node name="CollisionShape2D" type="CollisionShape2D" parent="JumpTargetArea2D"] shape = SubResource("5") disabled = true +debug_color = Color(1, 0, 1, 0.0980392) [node name="FallTargetArea2D" type="Area2D" parent="."] visible = false @@ -128,6 +139,7 @@ position = Vector2(250, 480) [node name="CollisionShape2D" type="CollisionShape2D" parent="FallTargetArea2D"] shape = SubResource("5") disabled = true +debug_color = Color(1, 0, 1, 0.0980392) [node name="StaticSceneFlat" parent="." instance=ExtResource("4")] position = Vector2(0, 12) diff --git a/2d/physics_tests/tests/functional/test_collision_pairs.gd b/2d/physics_tests/tests/functional/test_collision_pairs.gd index 94a648cb..61d4331f 100644 --- a/2d/physics_tests/tests/functional/test_collision_pairs.gd +++ b/2d/physics_tests/tests/functional/test_collision_pairs.gd @@ -133,7 +133,7 @@ func _add_collision(space_state: PhysicsDirectSpaceState2D, pos: Vector2, shape: var color := Color.GREEN if results.is_empty(): - color = Color.WHITE.darkened(0.5) + color = Color.BLACK # Draw collision query shape. add_shape(shape, shape_query.transform, color) diff --git a/2d/physics_tests/tests/functional/test_collision_pairs.tscn b/2d/physics_tests/tests/functional/test_collision_pairs.tscn index 3399a0cd..a05e7b1f 100644 --- a/2d/physics_tests/tests/functional/test_collision_pairs.tscn +++ b/2d/physics_tests/tests/functional/test_collision_pairs.tscn @@ -26,7 +26,7 @@ script = ExtResource("1") z_index = -1 z_as_relative = false -[node name="RigidBodyRectangle" type="RigidDynamicBody2D" parent="Shapes"] +[node name="RigidBodyRectangle" type="RigidBody2D" parent="Shapes"] position = Vector2(114.877, 248.76) freeze = true @@ -34,15 +34,17 @@ freeze = true rotation = -1.19206 scale = Vector2(1.2, 1.2) shape = SubResource("1") +debug_color = Color(1, 1, 0, 0.0980392) -[node name="RigidBodySphere" type="RigidDynamicBody2D" parent="Shapes"] +[node name="RigidBodySphere" type="RigidBody2D" parent="Shapes"] position = Vector2(314.894, 257.658) freeze = true [node name="CollisionShape2D" type="CollisionShape2D" parent="Shapes/RigidBodySphere"] shape = SubResource("2") +debug_color = Color(1, 1, 0, 0.0980392) -[node name="RigidBodyCapsule" type="RigidDynamicBody2D" parent="Shapes"] +[node name="RigidBodyCapsule" type="RigidBody2D" parent="Shapes"] position = Vector2(465.629, 261.204) freeze = true @@ -50,8 +52,9 @@ freeze = true rotation = -0.202458 scale = Vector2(1.2, 1.2) shape = SubResource("3") +debug_color = Color(1, 1, 0, 0.0980392) -[node name="RigidBodyConvexPolygon" type="RigidDynamicBody2D" parent="Shapes"] +[node name="RigidBodyConvexPolygon" type="RigidBody2D" parent="Shapes"] position = Vector2(613.385, 252.771) freeze = true @@ -62,7 +65,7 @@ polygon = PackedVector2Array(10.7, -54.5, 28.3596, -49.4067, 47.6282, -34.3806, modulate = Color(1, 1, 1, 0.392157) texture = ExtResource("2") -[node name="RigidBodyConcavePolygon" type="RigidDynamicBody2D" parent="Shapes"] +[node name="RigidBodyConcavePolygon" type="RigidBody2D" parent="Shapes"] position = Vector2(771.159, 252.771) freeze = true @@ -73,18 +76,20 @@ polygon = PackedVector2Array(-5.93512, -43.2195, 6.44476, -42.9695, 11.127, -54. modulate = Color(1, 1, 1, 0.392157) texture = ExtResource("2") -[node name="RigidBodyConcaveSegments" type="RigidDynamicBody2D" parent="Shapes"] +[node name="RigidBodyConcaveSegments" type="RigidBody2D" parent="Shapes"] position = Vector2(930.097, 252.771) freeze = true [node name="CollisionShape2D" type="CollisionShape2D" parent="Shapes/RigidBodyConcaveSegments"] shape = SubResource("4") +debug_color = Color(1, 1, 0, 0.0980392) [node name="GodotIcon" type="Sprite2D" parent="Shapes/RigidBodyConcaveSegments"] modulate = Color(1, 1, 1, 0.392157) texture = ExtResource("2") [node name="Controls" type="VBoxContainer" parent="."] +anchors_preset = 15 anchor_right = 1.0 anchor_bottom = 1.0 offset_left = 25.3619 @@ -92,54 +97,35 @@ offset_top = 416.765 offset_right = 218.362 offset_bottom = 458.765 theme_override_constants/separation = 10 -__meta__ = { -"_edit_use_anchors_": false -} [node name="OffsetH" type="HBoxContainer" parent="Controls"] -offset_right = 204.0 -offset_bottom = 26.0 +layout_mode = 2 theme_override_constants/separation = 20 alignment = 2 -__meta__ = { -"_edit_use_anchors_": false -} [node name="Label" type="Label" parent="Controls/OffsetH"] -offset_right = 64.0 -offset_bottom = 26.0 +layout_mode = 2 text = "Offset H" [node name="HSlider" type="HSlider" parent="Controls/OffsetH"] -offset_left = 84.0 -offset_right = 204.0 -offset_bottom = 16.0 -rect_min_size = Vector2(120, 0) +custom_minimum_size = Vector2(200, 0) +layout_mode = 2 min_value = -1.0 max_value = 1.0 step = 0.01 [node name="OffsetV" type="HBoxContainer" parent="Controls"] -offset_top = 36.0 -offset_right = 204.0 -offset_bottom = 62.0 +layout_mode = 2 theme_override_constants/separation = 20 alignment = 2 -__meta__ = { -"_edit_use_anchors_": false -} [node name="Label" type="Label" parent="Controls/OffsetV"] -offset_left = 2.0 -offset_right = 64.0 -offset_bottom = 26.0 +layout_mode = 2 text = "Offset V" [node name="HSlider" type="HSlider" parent="Controls/OffsetV"] -offset_left = 84.0 -offset_right = 204.0 -offset_bottom = 16.0 -rect_min_size = Vector2(120, 0) +custom_minimum_size = Vector2(200, 0) +layout_mode = 2 min_value = -1.0 max_value = 1.0 step = 0.01 diff --git a/2d/physics_tests/tests/functional/test_one_way_collision.tscn b/2d/physics_tests/tests/functional/test_one_way_collision.tscn index 9bc5834f..8f6646e0 100644 --- a/2d/physics_tests/tests/functional/test_one_way_collision.tscn +++ b/2d/physics_tests/tests/functional/test_one_way_collision.tscn @@ -155,6 +155,7 @@ position = Vector2(512, 300) [node name="CollisionShape2D" type="CollisionShape2D" parent="TargetArea2D"] shape = SubResource("CircleShape2D_e5nt1") +debug_color = Color(1, 0, 1, 0.0980392) [node name="OneWayStaticBody2D" type="StaticBody2D" parent="."] position = Vector2(512, 300) @@ -162,6 +163,7 @@ position = Vector2(512, 300) [node name="CollisionShape2D" type="CollisionShape2D" parent="OneWayStaticBody2D"] shape = SubResource("2") one_way_collision = true +debug_color = Color(0, 0.533333, 1, 0.0980392) [node name="RigidBody2D" type="RigidBody2D" parent="."] position = Vector2(300, 300) @@ -176,6 +178,7 @@ texture = ExtResource("2") [node name="CollisionShape2D" type="CollisionShape2D" parent="RigidBody2D"] shape = SubResource("3") +debug_color = Color(1, 1, 0, 0.0980392) [node name="CharacterBody2D" type="CharacterBody2D" parent="."] position = Vector2(300, 300) @@ -188,6 +191,7 @@ texture = ExtResource("2") [node name="CollisionShape2D" type="CollisionShape2D" parent="CharacterBody2D"] shape = SubResource("3") +debug_color = Color(0, 1, 0, 0.0980392) [connection signal="value_changed" from="Controls/PlatformSize/HSlider" to="." method="_update_platform_size"] [connection signal="value_changed" from="Controls/PlatformAngle/HSlider" to="." method="_update_platform_angle"] diff --git a/2d/physics_tests/tests/functional/test_raycasting.tscn b/2d/physics_tests/tests/functional/test_raycasting.tscn index 2f923f16..76460cca 100644 --- a/2d/physics_tests/tests/functional/test_raycasting.tscn +++ b/2d/physics_tests/tests/functional/test_raycasting.tscn @@ -26,7 +26,7 @@ theme_override_font_sizes/font_size = 16 z_index = -1 z_as_relative = false -[node name="RigidBodyRectangle" type="RigidDynamicBody2D" parent="Shapes"] +[node name="RigidBodyRectangle" type="RigidBody2D" parent="Shapes"] position = Vector2(114.877, 248.76) freeze = true @@ -34,15 +34,17 @@ freeze = true rotation = -1.19206 scale = Vector2(1.2, 1.2) shape = SubResource("1") +debug_color = Color(1, 1, 0, 0.0980392) -[node name="RigidBodySphere" type="RigidDynamicBody2D" parent="Shapes"] +[node name="RigidBodySphere" type="RigidBody2D" parent="Shapes"] position = Vector2(314.894, 257.658) freeze = true [node name="CollisionShape2D" type="CollisionShape2D" parent="Shapes/RigidBodySphere"] shape = SubResource("2") +debug_color = Color(1, 1, 0, 0.0980392) -[node name="RigidBodyCapsule" type="RigidDynamicBody2D" parent="Shapes"] +[node name="RigidBodyCapsule" type="RigidBody2D" parent="Shapes"] position = Vector2(465.629, 261.204) freeze = true @@ -50,8 +52,9 @@ freeze = true rotation = -0.202458 scale = Vector2(1.2, 1.2) shape = SubResource("3") +debug_color = Color(1, 1, 0, 0.0980392) -[node name="RigidBodyConvexPolygon" type="RigidDynamicBody2D" parent="Shapes"] +[node name="RigidBodyConvexPolygon" type="RigidBody2D" parent="Shapes"] position = Vector2(613.385, 252.771) freeze = true @@ -62,7 +65,7 @@ polygon = PackedVector2Array(10.7, -54.5, 28.3596, -49.4067, 47.6282, -34.3806, modulate = Color(1, 1, 1, 0.392157) texture = ExtResource("1") -[node name="RigidBodyConcavePolygon" type="RigidDynamicBody2D" parent="Shapes"] +[node name="RigidBodyConcavePolygon" type="RigidBody2D" parent="Shapes"] position = Vector2(771.159, 252.771) freeze = true @@ -73,7 +76,7 @@ polygon = PackedVector2Array(-5.93512, -43.2195, 6.44476, -42.9695, 11.127, -54. modulate = Color(1, 1, 1, 0.392157) texture = ExtResource("1") -[node name="RigidBodyConcaveSegments" type="RigidDynamicBody2D" parent="Shapes"] +[node name="RigidBodyConcaveSegments" type="RigidBody2D" parent="Shapes"] position = Vector2(930.097, 252.771) freeze = true diff --git a/2d/physics_tests/tests/functional/test_shapes.tscn b/2d/physics_tests/tests/functional/test_shapes.tscn index 69e64141..2ae6a8b2 100644 --- a/2d/physics_tests/tests/functional/test_shapes.tscn +++ b/2d/physics_tests/tests/functional/test_shapes.tscn @@ -20,23 +20,25 @@ script = ExtResource("2") [node name="DynamicShapes" type="Node2D" parent="."] -[node name="RigidBodyRectangle" type="RigidDynamicBody2D" parent="DynamicShapes"] +[node name="RigidBodyRectangle" type="RigidBody2D" parent="DynamicShapes"] position = Vector2(96, 127) script = ExtResource("3") [node name="CollisionShape2D" type="CollisionShape2D" parent="DynamicShapes/RigidBodyRectangle"] rotation = 0.675442 shape = SubResource("1") +debug_color = Color(1, 1, 0, 0.0980392) -[node name="RigidBodyCapsule" type="RigidDynamicBody2D" parent="DynamicShapes"] +[node name="RigidBodyCapsule" type="RigidBody2D" parent="DynamicShapes"] position = Vector2(270.165, 139.444) script = ExtResource("3") [node name="CollisionShape2D" type="CollisionShape2D" parent="DynamicShapes/RigidBodyCapsule"] rotation = -0.202458 shape = SubResource("2") +debug_color = Color(1, 1, 0, 0.0980392) -[node name="RigidBodyConcavePolygon" type="RigidDynamicBody2D" parent="DynamicShapes"] +[node name="RigidBodyConcavePolygon" type="RigidBody2D" parent="DynamicShapes"] position = Vector2(683.614, 132.749) script = ExtResource("3") @@ -49,7 +51,7 @@ self_modulate = Color(1, 1, 1, 0.392157) scale = Vector2(0.5, 0.5) texture = ExtResource("1") -[node name="RigidBodyConvexPolygon" type="RigidDynamicBody2D" parent="DynamicShapes"] +[node name="RigidBodyConvexPolygon" type="RigidBody2D" parent="DynamicShapes"] position = Vector2(473.536, 134.336) script = ExtResource("3") @@ -62,11 +64,12 @@ self_modulate = Color(1, 1, 1, 0.392157) scale = Vector2(0.5, 0.5) texture = ExtResource("1") -[node name="RigidBodySphere" type="RigidDynamicBody2D" parent="DynamicShapes"] +[node name="RigidBodySphere" type="RigidBody2D" parent="DynamicShapes"] position = Vector2(919.968, 115.129) script = ExtResource("3") [node name="CollisionShape2D" type="CollisionShape2D" parent="DynamicShapes/RigidBodySphere"] shape = SubResource("3") +debug_color = Color(1, 1, 0, 0.0980392) [node name="StaticScene" parent="." instance=ExtResource("6")] diff --git a/2d/physics_tests/tests/performance/test_perf_contact_islands.tscn b/2d/physics_tests/tests/performance/test_perf_contact_islands.tscn index 336d4604..f3653016 100644 --- a/2d/physics_tests/tests/performance/test_perf_contact_islands.tscn +++ b/2d/physics_tests/tests/performance/test_perf_contact_islands.tscn @@ -17,10 +17,10 @@ height = 17.0 [node name="Test" type="Node2D"] script = ExtResource("2") -_enable_debug_collision = false -spawns = [NodePath("SpawnTarget1"), NodePath("SpawnTarget2"), NodePath("SpawnTarget3"), NodePath("SpawnTarget4"), NodePath("SpawnTarget5"), NodePath("SpawnTarget6"), NodePath("SpawnTarget7"), NodePath("SpawnTarget8"), NodePath("SpawnTarget9")] +spawns = Array[NodePath]([NodePath("SpawnTarget1"), NodePath("SpawnTarget2"), NodePath("SpawnTarget3"), NodePath("SpawnTarget4"), NodePath("SpawnTarget5"), NodePath("SpawnTarget6"), NodePath("SpawnTarget7"), NodePath("SpawnTarget8"), NodePath("SpawnTarget9")]) spawn_count = 300 spawn_randomize = Vector2(10, 10) +_enable_debug_collision = false [node name="Options" parent="." instance=ExtResource("4")] @@ -57,28 +57,31 @@ position = Vector2(0, 125.017) [node name="DynamicShapes" type="Node2D" parent="."] -[node name="RigidBodyRectangle" type="RigidDynamicBody2D" parent="DynamicShapes"] +[node name="RigidBodyRectangle" type="RigidBody2D" parent="DynamicShapes"] position = Vector2(0, 1024) gravity_scale = 0.0 [node name="CollisionShape2D" type="CollisionShape2D" parent="DynamicShapes/RigidBodyRectangle"] shape = SubResource("1") +debug_color = Color(1, 1, 0, 0.0980392) -[node name="RigidBodySphere" type="RigidDynamicBody2D" parent="DynamicShapes"] +[node name="RigidBodySphere" type="RigidBody2D" parent="DynamicShapes"] position = Vector2(100, 1024) gravity_scale = 0.0 [node name="CollisionShape2D" type="CollisionShape2D" parent="DynamicShapes/RigidBodySphere"] shape = SubResource("2") +debug_color = Color(1, 1, 0, 0.0980392) -[node name="RigidBodyCapsule" type="RigidDynamicBody2D" parent="DynamicShapes"] +[node name="RigidBodyCapsule" type="RigidBody2D" parent="DynamicShapes"] position = Vector2(200, 1024) gravity_scale = 0.0 [node name="CollisionShape2D" type="CollisionShape2D" parent="DynamicShapes/RigidBodyCapsule"] shape = SubResource("3") +debug_color = Color(1, 1, 0, 0.0980392) -[node name="RigidBodyConvexPolygon" type="RigidDynamicBody2D" parent="DynamicShapes"] +[node name="RigidBodyConvexPolygon" type="RigidBody2D" parent="DynamicShapes"] position = Vector2(300, 1024) gravity_scale = 0.0 @@ -91,7 +94,7 @@ self_modulate = Color(1, 1, 1, 0.392157) scale = Vector2(0.1, 0.1) texture = ExtResource("3") -[node name="RigidBodyConcavePolygon" type="RigidDynamicBody2D" parent="DynamicShapes"] +[node name="RigidBodyConcavePolygon" type="RigidBody2D" parent="DynamicShapes"] position = Vector2(400, 1024) gravity_scale = 0.0 diff --git a/2d/physics_tests/tests/performance/test_perf_contacts.tscn b/2d/physics_tests/tests/performance/test_perf_contacts.tscn index 703d7298..d490def4 100644 --- a/2d/physics_tests/tests/performance/test_perf_contacts.tscn +++ b/2d/physics_tests/tests/performance/test_perf_contacts.tscn @@ -36,18 +36,21 @@ position = Vector2(0, 1024) [node name="CollisionShape2D" type="CollisionShape2D" parent="DynamicShapes/RigidBodyRectangle"] shape = SubResource("1") +debug_color = Color(1, 1, 0, 0.0980392) [node name="RigidBodySphere" type="RigidBody2D" parent="DynamicShapes"] position = Vector2(100, 1024) [node name="CollisionShape2D" type="CollisionShape2D" parent="DynamicShapes/RigidBodySphere"] shape = SubResource("2") +debug_color = Color(1, 1, 0, 0.0980392) [node name="RigidBodyCapsule" type="RigidBody2D" parent="DynamicShapes"] position = Vector2(200, 1024) [node name="CollisionShape2D" type="CollisionShape2D" parent="DynamicShapes/RigidBodyCapsule"] shape = SubResource("3") +debug_color = Color(1, 1, 0, 0.0980392) [node name="RigidBodyConvexPolygon" type="RigidBody2D" parent="DynamicShapes"] position = Vector2(300, 1024) diff --git a/2d/physics_tests/tests/static_scene_flat.tscn b/2d/physics_tests/tests/static_scene_flat.tscn index dd264b79..25632cde 100644 --- a/2d/physics_tests/tests/static_scene_flat.tscn +++ b/2d/physics_tests/tests/static_scene_flat.tscn @@ -10,3 +10,4 @@ position = Vector2(512, 550) [node name="CollisionShape2D" type="CollisionShape2D" parent="StaticBodyPolygon"] shape = SubResource("1") +debug_color = Color(0, 0.533333, 1, 0.0980392) diff --git a/2d/physics_tests/tests/test_options.tscn b/2d/physics_tests/tests/test_options.tscn index 86977c2f..c532170d 100644 --- a/2d/physics_tests/tests/test_options.tscn +++ b/2d/physics_tests/tests/test_options.tscn @@ -7,7 +7,7 @@ offset_left = 10.0 offset_top = 106.719 offset_right = 125.0 offset_bottom = 126.719 -text = "TEST OPTIONS" +text = "Test Options" flat = false align = 0 script = ExtResource("1") diff --git a/2d/physics_tests/utils/characterbody_controller.gd b/2d/physics_tests/utils/characterbody_controller.gd index cc23b6b6..df228b46 100644 --- a/2d/physics_tests/utils/characterbody_controller.gd +++ b/2d/physics_tests/utils/characterbody_controller.gd @@ -15,7 +15,7 @@ var _jumping := false var _keep_velocity := false -func _physics_process(_delta: float) -> void: +func _physics_process(delta: float) -> void: if _initial_velocity != Vector2.ZERO: _velocity = _initial_velocity _initial_velocity = Vector2.ZERO @@ -44,7 +44,7 @@ func _physics_process(_delta: float) -> void: _jumping = true _velocity.y = -_jump_force else: - _velocity.y += _gravity_force + _velocity.y += _gravity_force * delta * 60.0 floor_snap_length = _snap floor_stop_on_slope = _stop_on_slope diff --git a/2d/physics_tests/utils/max_steps_per_frame.gd b/2d/physics_tests/utils/max_steps_per_frame.gd new file mode 100644 index 00000000..4f03f4b1 --- /dev/null +++ b/2d/physics_tests/utils/max_steps_per_frame.gd @@ -0,0 +1,6 @@ +extends HBoxContainer + + +func _on_h_slider_value_changed(value: float) -> void: + $Value.text = str(roundi(value)) + Engine.max_physics_steps_per_frame = roundi(value) diff --git a/2d/physics_tests/utils/max_steps_per_frame.gd.uid b/2d/physics_tests/utils/max_steps_per_frame.gd.uid new file mode 100644 index 00000000..f057f90d --- /dev/null +++ b/2d/physics_tests/utils/max_steps_per_frame.gd.uid @@ -0,0 +1 @@ +uid://cvoeuonqmsye1 diff --git a/2d/physics_tests/utils/physics_interpolation.gd b/2d/physics_tests/utils/physics_interpolation.gd new file mode 100644 index 00000000..7239a0d9 --- /dev/null +++ b/2d/physics_tests/utils/physics_interpolation.gd @@ -0,0 +1,5 @@ +extends CheckButton + + +func _on_check_button_toggled(toggled_on: bool) -> void: + get_tree().physics_interpolation = toggled_on diff --git a/2d/physics_tests/utils/physics_interpolation.gd.uid b/2d/physics_tests/utils/physics_interpolation.gd.uid new file mode 100644 index 00000000..4b692a22 --- /dev/null +++ b/2d/physics_tests/utils/physics_interpolation.gd.uid @@ -0,0 +1 @@ +uid://ijebwwx4t8et diff --git a/2d/physics_tests/utils/rigidbody_controller.gd b/2d/physics_tests/utils/rigidbody_controller.gd index e07bc6f4..ab7c66d0 100644 --- a/2d/physics_tests/utils/rigidbody_controller.gd +++ b/2d/physics_tests/utils/rigidbody_controller.gd @@ -15,7 +15,7 @@ func _ready() -> void: gravity_scale = 0.0 -func _physics_process(_delta: float) -> void: +func _physics_process(delta: float) -> void: if _initial_velocity != Vector2.ZERO: _velocity = _initial_velocity _initial_velocity = Vector2.ZERO @@ -47,7 +47,7 @@ func _physics_process(_delta: float) -> void: # Reset gravity. _velocity.y = 0.0 else: - _velocity.y += _gravity_force + _velocity.y += _gravity_force * delta * 60.0 _jumping = false linear_velocity = _velocity diff --git a/2d/physics_tests/utils/ticks_per_second.gd b/2d/physics_tests/utils/ticks_per_second.gd new file mode 100644 index 00000000..a06cfd6e --- /dev/null +++ b/2d/physics_tests/utils/ticks_per_second.gd @@ -0,0 +1,6 @@ +extends HBoxContainer + + +func _on_h_slider_value_changed(value: float) -> void: + $Value.text = str(roundi(value)) + Engine.physics_ticks_per_second = roundi(value * Engine.time_scale) diff --git a/2d/physics_tests/utils/ticks_per_second.gd.uid b/2d/physics_tests/utils/ticks_per_second.gd.uid new file mode 100644 index 00000000..b4904773 --- /dev/null +++ b/2d/physics_tests/utils/ticks_per_second.gd.uid @@ -0,0 +1 @@ +uid://7kql0xtuc7ny diff --git a/2d/physics_tests/utils/time_scale.gd b/2d/physics_tests/utils/time_scale.gd new file mode 100644 index 00000000..938dd78a --- /dev/null +++ b/2d/physics_tests/utils/time_scale.gd @@ -0,0 +1,8 @@ +extends HBoxContainer + + +func _on_h_slider_value_changed(value: float) -> void: + value = maxf(0.1, value) + $Value.text = "%.1f×" % value + Engine.time_scale = value + Engine.physics_ticks_per_second = $"../TicksPerSecond/HSlider".value * value diff --git a/2d/physics_tests/utils/time_scale.gd.uid b/2d/physics_tests/utils/time_scale.gd.uid new file mode 100644 index 00000000..99803db9 --- /dev/null +++ b/2d/physics_tests/utils/time_scale.gd.uid @@ -0,0 +1 @@ +uid://beqnv31yip0bl diff --git a/3d/kinematic_character/project.godot b/3d/kinematic_character/project.godot index 4e906089..b834bb6d 100644 --- a/3d/kinematic_character/project.godot +++ b/3d/kinematic_character/project.godot @@ -84,6 +84,7 @@ exit={ common/physics_ticks_per_second=120 3d/default_gravity=13.0 +3d/physics_engine="Jolt Physics" common/physics_interpolation=true [rendering] diff --git a/3d/navigation/project.godot b/3d/navigation/project.godot index 79bb4bbf..832ceac5 100644 --- a/3d/navigation/project.godot +++ b/3d/navigation/project.godot @@ -27,6 +27,7 @@ gdscript/warnings/untyped_declaration=1 [physics] common/physics_ticks_per_second=120 +3d/physics_engine="Jolt Physics" common/physics_interpolation=true [rendering] diff --git a/3d/physics_tests/README.md b/3d/physics_tests/README.md index 6bbaab4e..fe0e5fb0 100644 --- a/3d/physics_tests/README.md +++ b/3d/physics_tests/README.md @@ -18,4 +18,4 @@ Check out this demo on the asset library: https://godotengine.org/asset-library/ ## Screenshots -![Screenshot](screenshots/screenshot.png) +![Screenshot](screenshots/physics_tests.webp) diff --git a/3d/physics_tests/assets/robot_head/godot3_robot_head.mesh b/3d/physics_tests/assets/robot_head/godot3_robot_head.mesh index 9d0d9ef5..2953c7a3 100644 Binary files a/3d/physics_tests/assets/robot_head/godot3_robot_head.mesh and b/3d/physics_tests/assets/robot_head/godot3_robot_head.mesh differ diff --git a/3d/physics_tests/main.tscn b/3d/physics_tests/main.tscn index 91618e69..93338095 100644 --- a/3d/physics_tests/main.tscn +++ b/3d/physics_tests/main.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=11 format=3 uid="uid://pfb5u7r1hl8t"] +[gd_scene load_steps=15 format=3 uid="uid://pfb5u7r1hl8t"] [ext_resource type="Script" uid="uid://34ftr8y77xc0" path="res://utils/label_fps.gd" id="1"] [ext_resource type="Script" uid="uid://bai0htaaejvop" path="res://utils/label_version.gd" id="2"] @@ -6,14 +6,19 @@ [ext_resource type="Script" uid="uid://dd0fbi0qttuuw" path="res://tests_menu.gd" id="4"] [ext_resource type="Script" uid="uid://bkvmvpx2kl536" path="res://utils/label_test.gd" id="5"] [ext_resource type="Script" uid="uid://bsrr8ude7isvn" path="res://utils/label_pause.gd" id="6"] +[ext_resource type="Script" uid="uid://7kql0xtuc7ny" path="res://utils/ticks_per_second.gd" id="8_dg77c"] +[ext_resource type="Script" uid="uid://beqnv31yip0bl" path="res://utils/time_scale.gd" id="9_ycdy4"] [ext_resource type="Script" uid="uid://eleg6e366qxd" path="res://utils/container_log.gd" id="10"] +[ext_resource type="Script" uid="uid://cvoeuonqmsye1" path="res://utils/max_steps_per_frame.gd" id="10_w48qg"] [ext_resource type="Script" uid="uid://pagh264d7unt" path="res://utils/scroll_log.gd" id="11"] +[ext_resource type="Script" uid="uid://ijebwwx4t8et" path="res://utils/physics_interpolation.gd" id="11_ycdy4"] [ext_resource type="Script" uid="uid://sjyvya2tmvni" path="res://tests.gd" id="12"] [sub_resource type="StyleBoxFlat" id="1"] bg_color = Color(0, 0, 0, 0.176471) [node name="Main" type="Control"] +process_mode = 3 layout_mode = 3 anchors_preset = 15 anchor_right = 1.0 @@ -29,7 +34,7 @@ offset_left = 10.0 offset_top = 10.0 offset_right = 125.0 offset_bottom = 30.0 -text = "TESTS" +text = "Tests" flat = false script = ExtResource("4") @@ -39,7 +44,8 @@ offset_left = 157.0 offset_top = 13.0 offset_right = 375.0 offset_bottom = 27.0 -text = "P - TOGGLE PAUSE / R - RESTART / C - TOGGLE COLLISION / F - TOGGLE FULL SCREEN / ESC - QUIT" +theme_override_constants/outline_size = 4 +text = "P: Toggle Pause | R: Restart | C: Toggle Collision | F: Toggle Fullscreen | ESC: Quit" [node name="LabelFPS" type="Label" parent="."] layout_mode = 1 @@ -57,6 +63,7 @@ text = "FPS: 0" script = ExtResource("1") [node name="LabelEngine" type="Label" parent="."] +self_modulate = Color(1, 1, 1, 0.752941) layout_mode = 1 anchors_preset = 2 anchor_top = 1.0 @@ -72,6 +79,7 @@ text = "Physics engine:" script = ExtResource("3") [node name="LabelVersion" type="Label" parent="."] +self_modulate = Color(1, 1, 1, 0.752941) layout_mode = 1 anchors_preset = 2 anchor_top = 1.0 @@ -83,7 +91,7 @@ offset_bottom = -69.0 grow_vertical = 0 theme_override_colors/font_outline_color = Color(0, 0, 0, 1) theme_override_constants/outline_size = 4 -text = "Godot Version:" +text = "Godot version:" script = ExtResource("2") [node name="LabelTest" type="Label" parent="."] @@ -115,10 +123,122 @@ offset_bottom = -547.0 grow_horizontal = 2 grow_vertical = 0 theme_override_colors/font_color = Color(1, 1, 0, 1) +theme_override_constants/outline_size = 6 theme_override_font_sizes/font_size = 24 -text = "PAUSED" +text = "Paused" script = ExtResource("6") +[node name="Options" type="VBoxContainer" parent="."] +layout_mode = 1 +anchors_preset = 1 +anchor_left = 1.0 +anchor_right = 1.0 +offset_left = -392.0 +offset_top = 56.0 +offset_right = -16.0 +offset_bottom = 174.0 +grow_horizontal = 0 +theme_override_constants/separation = 6 + +[node name="TicksPerSecond" type="HBoxContainer" parent="Options"] +layout_mode = 2 +tooltip_text = "Higher values make physics more precise at the cost of higher CPU utilization. +Low values may result in objects phasing through each other (tunneling). +Physics ticks per second are automatically multiplied by Time Scale in this project." +theme_override_constants/separation = 10 +script = ExtResource("8_dg77c") + +[node name="Label" type="Label" parent="Options/TicksPerSecond"] +custom_minimum_size = Vector2(164, 0) +layout_mode = 2 +theme_override_colors/font_outline_color = Color(0, 0, 0, 1) +theme_override_constants/outline_size = 4 +text = "Ticks per Second" + +[node name="HSlider" type="HSlider" parent="Options/TicksPerSecond"] +custom_minimum_size = Vector2(160, 0) +layout_mode = 2 +size_flags_vertical = 4 +min_value = 10.0 +max_value = 240.0 +step = 10.0 +value = 60.0 + +[node name="Value" type="Label" parent="Options/TicksPerSecond"] +layout_mode = 2 +theme_override_colors/font_outline_color = Color(0, 0, 0, 1) +theme_override_constants/outline_size = 4 +text = "60" + +[node name="TimeScale" type="HBoxContainer" parent="Options"] +layout_mode = 2 +tooltip_text = "Game speed multiplier. Physics ticks per second are +automatically multiplied by Time Scale in this project +to ensure accurate simulation regardless of time scale." +theme_override_constants/separation = 10 +script = ExtResource("9_ycdy4") + +[node name="Label" type="Label" parent="Options/TimeScale"] +custom_minimum_size = Vector2(164, 0) +layout_mode = 2 +theme_override_colors/font_outline_color = Color(0, 0, 0, 1) +theme_override_constants/outline_size = 4 +text = "Time Scale" + +[node name="HSlider" type="HSlider" parent="Options/TimeScale"] +custom_minimum_size = Vector2(160, 0) +layout_mode = 2 +size_flags_vertical = 4 +max_value = 5.0 +step = 0.5 +value = 0.5 + +[node name="Value" type="Label" parent="Options/TimeScale"] +layout_mode = 2 +theme_override_colors/font_outline_color = Color(0, 0, 0, 1) +theme_override_constants/outline_size = 4 +text = "1.0×" + +[node name="MaxStepsPerFrame" type="HBoxContainer" parent="Options"] +layout_mode = 2 +tooltip_text = "Physics will slow down if more physics steps +than this value need to be simulated in a +single rendered frame." +theme_override_constants/separation = 10 +script = ExtResource("10_w48qg") + +[node name="Label" type="Label" parent="Options/MaxStepsPerFrame"] +custom_minimum_size = Vector2(164, 0) +layout_mode = 2 +theme_override_colors/font_outline_color = Color(0, 0, 0, 1) +theme_override_constants/outline_size = 4 +text = "Max Steps per Frame" + +[node name="HSlider" type="HSlider" parent="Options/MaxStepsPerFrame"] +custom_minimum_size = Vector2(160, 0) +layout_mode = 2 +size_flags_vertical = 4 +min_value = 1.0 +max_value = 20.0 +value = 8.0 + +[node name="Value" type="Label" parent="Options/MaxStepsPerFrame"] +layout_mode = 2 +theme_override_colors/font_outline_color = Color(0, 0, 0, 1) +theme_override_constants/outline_size = 4 +text = "8" + +[node name="PhysicsInterpolation" type="CheckButton" parent="Options"] +custom_minimum_size = Vector2(217, 0) +layout_mode = 2 +size_flags_horizontal = 0 +tooltip_text = "Smooths out rendering regardless of the physics tick rate. +This is a purely visual effect and has no impact on the physics simulation." +theme_override_constants/outline_size = 4 +button_pressed = true +text = "Physics Interpolation" +script = ExtResource("11_ycdy4") + [node name="PanelLog" type="Panel" parent="."] layout_mode = 1 anchors_preset = 3 @@ -126,10 +246,11 @@ anchor_left = 1.0 anchor_top = 1.0 anchor_right = 1.0 anchor_bottom = 1.0 -offset_left = -482.0 -offset_top = -237.0 +offset_left = -629.0 +offset_top = -252.0 grow_horizontal = 0 grow_vertical = 0 +mouse_filter = 1 theme_override_styles/panel = SubResource("1") [node name="ButtonClear" type="Button" parent="PanelLog"] @@ -139,8 +260,8 @@ anchor_left = 1.0 anchor_top = 1.0 anchor_right = 1.0 anchor_bottom = 1.0 -offset_left = -48.0 -offset_top = -25.0 +offset_left = -64.0 +offset_top = -36.0 offset_right = -5.0 offset_bottom = -5.0 grow_horizontal = 0 @@ -155,20 +276,21 @@ anchor_left = 1.0 anchor_top = 1.0 anchor_right = 1.0 anchor_bottom = 1.0 -offset_left = -189.0 +offset_left = -269.0 offset_top = -35.0 -offset_right = -57.0 +offset_right = -70.0 offset_bottom = -4.0 grow_horizontal = 0 grow_vertical = 0 focus_mode = 0 -text = "Auto Scroll" +button_pressed = true +text = "Automatic Scrolling" [node name="ScrollLog" type="ScrollContainer" parent="PanelLog"] layout_mode = 0 offset_left = 10.0 offset_top = 5.0 -offset_right = 472.0 +offset_right = 616.0 offset_bottom = 194.0 script = ExtResource("11") auto_scroll = true @@ -185,5 +307,9 @@ layout_mode = 2 text = "Log start" max_lines_visible = 5 +[connection signal="value_changed" from="Options/TicksPerSecond/HSlider" to="Options/TicksPerSecond" method="_on_h_slider_value_changed"] +[connection signal="value_changed" from="Options/TimeScale/HSlider" to="Options/TimeScale" method="_on_h_slider_value_changed"] +[connection signal="value_changed" from="Options/MaxStepsPerFrame/HSlider" to="Options/MaxStepsPerFrame" method="_on_h_slider_value_changed"] +[connection signal="toggled" from="Options/PhysicsInterpolation" to="Options/PhysicsInterpolation" method="_on_check_button_toggled"] [connection signal="pressed" from="PanelLog/ButtonClear" to="PanelLog/ScrollLog/VBoxLog" method="clear"] [connection signal="toggled" from="PanelLog/CheckBoxScroll" to="PanelLog/ScrollLog" method="_on_check_box_scroll_toggled"] diff --git a/3d/physics_tests/project.godot b/3d/physics_tests/project.godot index 78dbda73..9371ed52 100644 --- a/3d/physics_tests/project.godot +++ b/3d/physics_tests/project.godot @@ -95,7 +95,15 @@ character_jump={ [physics] -jolt_physics_3d/limits/max_bodies=20480 -jolt_physics_3d/limits/max_body_pairs=131072 -jolt_physics_3d/limits/max_contact_constraints=40960 +3d/physics_engine="Jolt Physics" +jolt_physics_3d/limits/temporary_memory_buffer_size=128 +jolt_physics_3d/limits/max_bodies=262144 +jolt_physics_3d/limits/max_body_pairs=262144 +jolt_physics_3d/limits/max_contact_constraints=262144 common/physics_interpolation=true + +[rendering] + +renderer/rendering_method="gl_compatibility" +renderer/rendering_method.mobile="gl_compatibility" +anti_aliasing/quality/msaa_3d=2 diff --git a/3d/physics_tests/screenshots/physics_tests.webp b/3d/physics_tests/screenshots/physics_tests.webp new file mode 100644 index 00000000..d993dd10 Binary files /dev/null and b/3d/physics_tests/screenshots/physics_tests.webp differ diff --git a/3d/physics_tests/screenshots/screenshot.png b/3d/physics_tests/screenshots/screenshot.png deleted file mode 100644 index 024fc965..00000000 Binary files a/3d/physics_tests/screenshots/screenshot.png and /dev/null differ diff --git a/3d/physics_tests/test.gd b/3d/physics_tests/test.gd index bb0300d6..5756f7d1 100644 --- a/3d/physics_tests/test.gd +++ b/3d/physics_tests/test.gd @@ -71,6 +71,7 @@ func create_rigidbody(shape: Shape3D, pickable: bool = false, transform: Transfo var collision := CollisionShape3D.new() collision.shape = shape collision.transform = transform + collision.debug_color = Color.YELLOW var body := RigidBody3D.new() body.add_child(collision) diff --git a/3d/physics_tests/tests/functional/test_collision_pairs.tscn b/3d/physics_tests/tests/functional/test_collision_pairs.tscn index 067ef9c4..2d4962c6 100644 --- a/3d/physics_tests/tests/functional/test_collision_pairs.tscn +++ b/3d/physics_tests/tests/functional/test_collision_pairs.tscn @@ -89,6 +89,7 @@ freeze = true [node name="CollisionShape" type="CollisionShape3D" parent="Shapes/RigidBodyBox"] transform = Transform3D(0.579556, 0.0885213, 0.145926, 0, 0.939693, -0.205212, -0.155291, 0.330366, 0.544604, 0, 0, 0) shape = SubResource("1") +debug_color = Color(1, 1, 0, 1) [node name="RigidBodySphere" type="RigidBody3D" parent="Shapes"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -3, 0, 0) @@ -97,6 +98,7 @@ freeze = true [node name="CollisionShape" type="CollisionShape3D" parent="Shapes/RigidBodySphere"] transform = Transform3D(1.2, 0, 0, 0, 1.2, 0, 0, 0, 1.2, 0, 0, 0) shape = SubResource("2") +debug_color = Color(1, 1, 0, 1) [node name="RigidBodyCapsule" type="RigidBody3D" parent="Shapes"] freeze = true @@ -104,6 +106,7 @@ freeze = true [node name="CollisionShape" type="CollisionShape3D" parent="Shapes/RigidBodyCapsule"] transform = Transform3D(0.8, 0, 0, 0, 0.8, 0, 0, 0, 0.8, 0, 0, 0) shape = SubResource("3") +debug_color = Color(1, 1, 0, 1) [node name="RigidBodyCylinder" type="RigidBody3D" parent="Shapes"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 3, 0, 0) @@ -112,6 +115,7 @@ freeze = true [node name="CollisionShape" type="CollisionShape3D" parent="Shapes/RigidBodyCylinder"] transform = Transform3D(0.772741, -0.258819, 2.59821e-08, 0.2, 0.933013, -0.207055, 0.0535898, 0.25, 0.772741, 0, 0, 0) shape = SubResource("4") +debug_color = Color(1, 1, 0, 1) [node name="RigidBodyConvexPolygon" type="RigidBody3D" parent="Shapes"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 6, -0.211, 0) @@ -120,6 +124,7 @@ freeze = true [node name="CollisionShape" type="CollisionShape3D" parent="Shapes/RigidBodyConvexPolygon"] transform = Transform3D(2, 0, 0, 0, 2.95442, 0.347296, 0, -0.520945, 1.96962, 0, 0.35, 0) shape = SubResource("5") +debug_color = Color(1, 1, 0, 1) [node name="RigidBodyConcavePolygon" type="StaticBody3D" parent="Shapes"] transform = Transform3D(2, 0, 0, 0, 2, 0, 0, 0, 2, 0, -6, 3.934) @@ -127,6 +132,7 @@ transform = Transform3D(2, 0, 0, 0, 2, 0, 0, 0, 2, 0, -6, 3.934) [node name="CollisionShape" type="CollisionShape3D" parent="Shapes/RigidBodyConcavePolygon"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1, 0) shape = ExtResource("1") +debug_color = Color(0, 0.533333, 1, 1) [node name="Camera3D" type="Camera3D" parent="."] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 8.38087, 11.8164) diff --git a/3d/physics_tests/tests/functional/test_compound_shapes.tscn b/3d/physics_tests/tests/functional/test_compound_shapes.tscn index 30061035..322a4006 100644 --- a/3d/physics_tests/tests/functional/test_compound_shapes.tscn +++ b/3d/physics_tests/tests/functional/test_compound_shapes.tscn @@ -15,120 +15,140 @@ script = ExtResource("2") [node name="DynamicShapes" type="Node3D" parent="."] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 9.35591, 0) -[node name="RigidBodyG" type="RigidDynamicBody3D" parent="DynamicShapes"] +[node name="RigidBodyG" type="RigidBody3D" parent="DynamicShapes"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -5.51361, 0, 0) [node name="CollisionShape1" type="CollisionShape3D" parent="DynamicShapes/RigidBodyG"] transform = Transform3D(-2.44381e-07, -0.3, 0, 1.5, -4.88762e-08, 0, 0, 0, 0.3, -0.8, 0, 0) shape = SubResource("1") +debug_color = Color(1, 1, 0, 1) [node name="CollisionShape2" type="CollisionShape3D" parent="DynamicShapes/RigidBodyG"] transform = Transform3D(0.8, 0, 4.26326e-15, 0, 0.3, 0, -1.13687e-14, 0, 0.3, 0.3, -1.2, 0) shape = SubResource("1") +debug_color = Color(1, 1, 0, 1) [node name="CollisionShape3" type="CollisionShape3D" parent="DynamicShapes/RigidBodyG"] transform = Transform3D(-8.14603e-08, -0.3, 0, 0.5, -4.88762e-08, 0, 0, 0, 0.3, 0.8, -0.5, 0) shape = SubResource("1") +debug_color = Color(1, 1, 0, 1) [node name="CollisionShape4" type="CollisionShape3D" parent="DynamicShapes/RigidBodyG"] transform = Transform3D(0.8, 0, 4.26326e-15, 0, 0.3, 0, -1.13687e-14, 0, 0.3, 0.3, 1.2, 0) shape = SubResource("1") +debug_color = Color(1, 1, 0, 1) -[node name="RigidBodyO" type="RigidDynamicBody3D" parent="DynamicShapes"] +[node name="RigidBodyO" type="RigidBody3D" parent="DynamicShapes"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2.65654, 0, 0) [node name="CollisionShape1" type="CollisionShape3D" parent="DynamicShapes/RigidBodyO"] transform = Transform3D(-2.44381e-07, -0.3, 0, 1.5, -4.88762e-08, 0, 0, 0, 0.3, -0.8, 0, 0) shape = SubResource("1") +debug_color = Color(1, 1, 0, 1) [node name="CollisionShape2" type="CollisionShape3D" parent="DynamicShapes/RigidBodyO"] transform = Transform3D(0.5, 0, 4.26326e-15, 0, 0.3, 0, -7.10543e-15, 0, 0.3, 0, 1.2, 0) shape = SubResource("1") +debug_color = Color(1, 1, 0, 1) [node name="CollisionShape3" type="CollisionShape3D" parent="DynamicShapes/RigidBodyO"] transform = Transform3D(0.5, 0, 4.26326e-15, 0, 0.3, 0, -7.10543e-15, 0, 0.3, 0, -1.2, 0) shape = SubResource("1") +debug_color = Color(1, 1, 0, 1) [node name="CollisionShape4" type="CollisionShape3D" parent="DynamicShapes/RigidBodyO"] transform = Transform3D(-2.44381e-07, -0.3, 0, 1.5, -4.88762e-08, 0, 0, 0, 0.3, 0.8, 0, 0) shape = SubResource("1") +debug_color = Color(1, 1, 0, 1) -[node name="RigidBodyD" type="RigidDynamicBody3D" parent="DynamicShapes"] +[node name="RigidBodyD" type="RigidBody3D" parent="DynamicShapes"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.248918, 0, 0) [node name="CollisionShape1" type="CollisionShape3D" parent="DynamicShapes/RigidBodyD"] transform = Transform3D(-2.44381e-07, -0.3, 0, 1.5, -4.88762e-08, 0, 0, 0, 0.3, -0.8, 0, 0) shape = SubResource("1") +debug_color = Color(1, 1, 0, 1) [node name="CollisionShape2" type="CollisionShape3D" parent="DynamicShapes/RigidBodyD"] transform = Transform3D(0.5, 0, 4.26326e-15, 0, 0.3, 0, -7.10543e-15, 0, 0.3, 0, 1.2, 0) shape = SubResource("1") +debug_color = Color(1, 1, 0, 1) [node name="CollisionShape3" type="CollisionShape3D" parent="DynamicShapes/RigidBodyD"] transform = Transform3D(0.5, 0, 4.26326e-15, 0, 0.3, 0, -7.10543e-15, 0, 0.3, 0, -1.2, 0) shape = SubResource("1") +debug_color = Color(1, 1, 0, 1) [node name="CollisionShape4" type="CollisionShape3D" parent="DynamicShapes/RigidBodyD"] transform = Transform3D(-1.46629e-07, -0.3, 0, 0.9, -4.88762e-08, 0, 0, 0, 0.3, 0.8, 0, 0) shape = SubResource("1") +debug_color = Color(1, 1, 0, 1) -[node name="RigidBodyO2" type="RigidDynamicBody3D" parent="DynamicShapes"] +[node name="RigidBodyO2" type="RigidBody3D" parent="DynamicShapes"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2.97932, 0, 0) [node name="CollisionShape1" type="CollisionShape3D" parent="DynamicShapes/RigidBodyO2"] transform = Transform3D(-2.44381e-07, -0.3, 0, 1.5, -4.88762e-08, 0, 0, 0, 0.3, -0.8, 0, 0) shape = SubResource("1") +debug_color = Color(1, 1, 0, 1) [node name="CollisionShape2" type="CollisionShape3D" parent="DynamicShapes/RigidBodyO2"] transform = Transform3D(0.5, 0, 4.26326e-15, 0, 0.3, 0, -7.10543e-15, 0, 0.3, 0, 1.2, 0) shape = SubResource("1") +debug_color = Color(1, 1, 0, 1) [node name="CollisionShape3" type="CollisionShape3D" parent="DynamicShapes/RigidBodyO2"] transform = Transform3D(0.5, 0, 4.26326e-15, 0, 0.3, 0, -7.10543e-15, 0, 0.3, 0, -1.2, 0) shape = SubResource("1") +debug_color = Color(1, 1, 0, 1) [node name="CollisionShape4" type="CollisionShape3D" parent="DynamicShapes/RigidBodyO2"] transform = Transform3D(-2.44381e-07, -0.3, 0, 1.5, -4.88762e-08, 0, 0, 0, 0.3, 0.8, 0, 0) shape = SubResource("1") +debug_color = Color(1, 1, 0, 1) -[node name="RigidBodyT" type="RigidDynamicBody3D" parent="DynamicShapes"] +[node name="RigidBodyT" type="RigidBody3D" parent="DynamicShapes"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 5.46836, 0, 0) [node name="CollisionShape1" type="CollisionShape3D" parent="DynamicShapes/RigidBodyT"] transform = Transform3D(-1.95505e-07, -0.3, 0, 1.2, -4.88762e-08, 0, 0, 0, 0.3, 0, -0.3, 0) shape = SubResource("1") +debug_color = Color(1, 1, 0, 1) [node name="CollisionShape2" type="CollisionShape3D" parent="DynamicShapes/RigidBodyT"] transform = Transform3D(1, 0, 4.26326e-15, 0, 0.3, 0, -1.42109e-14, 0, 0.3, 0, 1.2, 0) shape = SubResource("1") +debug_color = Color(1, 1, 0, 1) [node name="StaticBodyPins" type="StaticBody3D" parent="."] [node name="CollisionShape" type="CollisionShape3D" parent="StaticBodyPins"] transform = Transform3D(1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 9.13207, 0) shape = SubResource("2") +debug_color = Color(0, 0.501961, 1, 1) [node name="CollisionShape2" type="CollisionShape3D" parent="StaticBodyPins"] transform = Transform3D(1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, -2.71742, 9.13207, 0) shape = SubResource("2") +debug_color = Color(0, 0.501961, 1, 1) [node name="CollisionShape3" type="CollisionShape3D" parent="StaticBodyPins"] transform = Transform3D(1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, -5.64188, 9.13207, 0) shape = SubResource("2") +debug_color = Color(0, 0.501961, 1, 1) [node name="CollisionShape4" type="CollisionShape3D" parent="StaticBodyPins"] transform = Transform3D(1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 2.87444, 9.13207, 0) shape = SubResource("2") +debug_color = Color(0, 0.501961, 1, 1) [node name="CollisionShape5" type="CollisionShape3D" parent="StaticBodyPins"] transform = Transform3D(1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 4.81639, 9.13207, 0) shape = SubResource("2") +debug_color = Color(0, 0.501961, 1, 1) [node name="StaticScene" parent="." instance=ExtResource("1")] [node name="Camera3D" type="Camera3D" parent="."] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 4.53602, 22.1236) script = ExtResource("3") - -[node name="OmniLight" type="OmniLight3D" parent="Camera3D"] -omni_range = 50.0 diff --git a/3d/physics_tests/tests/functional/test_friction.tscn b/3d/physics_tests/tests/functional/test_friction.tscn index a7dbafee..72de58cb 100644 --- a/3d/physics_tests/tests/functional/test_friction.tscn +++ b/3d/physics_tests/tests/functional/test_friction.tscn @@ -31,59 +31,54 @@ physics_material_override = SubResource("1") [node name="CollisionShape" type="CollisionShape3D" parent="StaticBodyFriction0"] transform = Transform3D(5, 0, 0, 0, 1, 0, 0, 0, 50, 0, 0, 0) shape = SubResource("2") +debug_color = Color(0, 0.533333, 1, 1) [node name="RigidBodies" type="Node3D" parent="StaticBodyFriction0"] transform = Transform3D(1, 0, 0, 0, 0.866026, 0.5, 0, -0.5, 0.866026, -3, -7.431, 4.291) -[node name="RigidBodyFriction0" type="RigidDynamicBody3D" parent="StaticBodyFriction0/RigidBodies"] +[node name="RigidBodyFriction0" type="RigidBody3D" parent="StaticBodyFriction0/RigidBodies"] transform = Transform3D(1, 0, 0, 0, 0.866025, -0.5, 0, 0.5, 0.866025, 0, 10, 0) physics_material_override = SubResource("3") [node name="CollisionShape" type="CollisionShape3D" parent="StaticBodyFriction0/RigidBodies/RigidBodyFriction0"] shape = SubResource("4") +debug_color = Color(1, 1, 0, 1) [node name="LabelFriction" type="Label" parent="StaticBodyFriction0/RigidBodies/RigidBodyFriction0"] offset_right = 40.0 offset_bottom = 14.0 text = "0" script = ExtResource("2") -__meta__ = { -"_edit_use_anchors_": false -} world_offset = Vector3(0, 1.5, 0) -[node name="RigidBodyFriction05" type="RigidDynamicBody3D" parent="StaticBodyFriction0/RigidBodies"] +[node name="RigidBodyFriction05" type="RigidBody3D" parent="StaticBodyFriction0/RigidBodies"] transform = Transform3D(1, 0, 0, 0, 0.866025, -0.5, 0, 0.5, 0.866025, 3, 10, 0) physics_material_override = SubResource("5") [node name="CollisionShape" type="CollisionShape3D" parent="StaticBodyFriction0/RigidBodies/RigidBodyFriction05"] shape = SubResource("4") +debug_color = Color(1, 1, 0, 1) [node name="LabelFriction" type="Label" parent="StaticBodyFriction0/RigidBodies/RigidBodyFriction05"] offset_right = 40.0 offset_bottom = 14.0 text = "0.5" script = ExtResource("2") -__meta__ = { -"_edit_use_anchors_": false -} world_offset = Vector3(0, 1.5, 0) -[node name="RigidBodyFriction1" type="RigidDynamicBody3D" parent="StaticBodyFriction0/RigidBodies"] +[node name="RigidBodyFriction1" type="RigidBody3D" parent="StaticBodyFriction0/RigidBodies"] transform = Transform3D(1, 0, 0, 0, 0.866025, -0.5, 0, 0.5, 0.866025, 6, 10, 0) physics_material_override = SubResource("6") [node name="CollisionShape" type="CollisionShape3D" parent="StaticBodyFriction0/RigidBodies/RigidBodyFriction1"] shape = SubResource("4") +debug_color = Color(1, 1, 0, 1) [node name="LabelFriction" type="Label" parent="StaticBodyFriction0/RigidBodies/RigidBodyFriction1"] offset_right = 40.0 offset_bottom = 14.0 text = "1" script = ExtResource("2") -__meta__ = { -"_edit_use_anchors_": false -} world_offset = Vector3(0, 1.5, 0) [node name="StaticBodyFriction1" type="StaticBody3D" parent="."] @@ -93,68 +88,61 @@ physics_material_override = SubResource("7") [node name="CollisionShape" type="CollisionShape3D" parent="StaticBodyFriction1"] transform = Transform3D(5, 0, 0, 0, 1, 0, 0, 0, 50, 0, 0, 0) shape = SubResource("2") +debug_color = Color(0, 0.533333, 1, 1) [node name="RigidBodies" type="Node3D" parent="StaticBodyFriction1"] transform = Transform3D(1, 0, 0, 0, 0.866026, 0.5, 0, -0.5, 0.866026, -3, -7.431, 4.291) -[node name="RigidBodyFriction0" type="RigidDynamicBody3D" parent="StaticBodyFriction1/RigidBodies"] +[node name="RigidBodyFriction0" type="RigidBody3D" parent="StaticBodyFriction1/RigidBodies"] transform = Transform3D(1, 0, 0, 0, 0.866025, -0.5, 0, 0.5, 0.866025, 0, 10, 0) physics_material_override = SubResource("3") [node name="CollisionShape" type="CollisionShape3D" parent="StaticBodyFriction1/RigidBodies/RigidBodyFriction0"] shape = SubResource("4") +debug_color = Color(1, 1, 0, 1) [node name="LabelFriction" type="Label" parent="StaticBodyFriction1/RigidBodies/RigidBodyFriction0"] offset_right = 40.0 offset_bottom = 14.0 text = "0" script = ExtResource("2") -__meta__ = { -"_edit_use_anchors_": false -} world_offset = Vector3(0, 1.5, 0) -[node name="RigidBodyFriction05" type="RigidDynamicBody3D" parent="StaticBodyFriction1/RigidBodies"] +[node name="RigidBodyFriction05" type="RigidBody3D" parent="StaticBodyFriction1/RigidBodies"] transform = Transform3D(1, 0, 0, 0, 0.866025, -0.5, 0, 0.5, 0.866025, 3, 10, 0) physics_material_override = SubResource("5") [node name="CollisionShape" type="CollisionShape3D" parent="StaticBodyFriction1/RigidBodies/RigidBodyFriction05"] shape = SubResource("4") +debug_color = Color(1, 1, 0, 1) [node name="LabelFriction" type="Label" parent="StaticBodyFriction1/RigidBodies/RigidBodyFriction05"] offset_right = 40.0 offset_bottom = 14.0 text = "0.5" script = ExtResource("2") -__meta__ = { -"_edit_use_anchors_": false -} world_offset = Vector3(0, 1.5, 0) -[node name="RigidBodyFriction1" type="RigidDynamicBody3D" parent="StaticBodyFriction1/RigidBodies"] +[node name="RigidBodyFriction1" type="RigidBody3D" parent="StaticBodyFriction1/RigidBodies"] transform = Transform3D(1, 0, 0, 0, 0.866025, -0.5, 0, 0.5, 0.866025, 6, 10, 0) physics_material_override = SubResource("6") [node name="CollisionShape" type="CollisionShape3D" parent="StaticBodyFriction1/RigidBodies/RigidBodyFriction1"] shape = SubResource("4") +debug_color = Color(1, 1, 0, 1) [node name="LabelFriction" type="Label" parent="StaticBodyFriction1/RigidBodies/RigidBodyFriction1"] offset_right = 40.0 offset_bottom = 14.0 text = "1" script = ExtResource("2") -__meta__ = { -"_edit_use_anchors_": false -} world_offset = Vector3(0, 1.5, 0) [node name="Camera3D" type="Camera3D" parent="."] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 4.53602, 22.1236) -[node name="OmniLight" type="OmniLight3D" parent="Camera3D"] -omni_range = 50.0 - [node name="LabelGround0" type="Label" parent="."] +anchors_preset = 5 anchor_left = 0.5 anchor_right = 0.5 offset_left = -164.0 @@ -162,11 +150,9 @@ offset_top = 80.0 offset_right = -28.0 offset_bottom = 94.0 text = "GROUND FRICTION 0" -__meta__ = { -"_edit_use_anchors_": false -} [node name="LabelGround1" type="Label" parent="."] +anchors_preset = 5 anchor_left = 0.5 anchor_right = 0.5 offset_left = 31.0 @@ -174,6 +160,3 @@ offset_top = 80.0 offset_right = 167.0 offset_bottom = 94.0 text = "GROUND FRICTION 1" -__meta__ = { -"_edit_use_anchors_": false -} diff --git a/3d/physics_tests/tests/functional/test_joints.tscn b/3d/physics_tests/tests/functional/test_joints.tscn index 7b5c0fdf..cc9bf92a 100644 --- a/3d/physics_tests/tests/functional/test_joints.tscn +++ b/3d/physics_tests/tests/functional/test_joints.tscn @@ -13,9 +13,6 @@ offset_top = 78.0 offset_right = 171.0 offset_bottom = 92.0 text = "Joint Type: " -__meta__ = { -"_edit_use_anchors_": false -} [node name="Options" parent="." instance=ExtResource("3")] @@ -36,6 +33,3 @@ __meta__ = { [node name="Camera3D" type="Camera3D" parent="."] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 6.19796) script = ExtResource("1") - -[node name="OmniLight" type="OmniLight3D" parent="Camera3D"] -omni_range = 50.0 diff --git a/3d/physics_tests/tests/functional/test_moving_platform.tscn b/3d/physics_tests/tests/functional/test_moving_platform.tscn index 16e31f81..93d43147 100644 --- a/3d/physics_tests/tests/functional/test_moving_platform.tscn +++ b/3d/physics_tests/tests/functional/test_moving_platform.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=13 format=3 uid="uid://dgh5drb4q81kh"] +[gd_scene load_steps=15 format=3 uid="uid://dgh5drb4q81kh"] [ext_resource type="Script" uid="uid://cx8vo58lobtgu" path="res://utils/camera_orbit.gd" id="1"] [ext_resource type="Script" uid="uid://uo2swke2y6v8" path="res://tests/functional/test_moving_platform.gd" id="2"] @@ -28,6 +28,40 @@ size = Vector3(4, 0.4, 2) [sub_resource type="Animation" id="9"] length = 9.0 +loop_mode = 1 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath(".:position") +tracks/0/interp = 2 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0, 4.5), +"transitions": PackedFloat32Array(1, 1), +"update": 0, +"values": [Vector3(-7, -4.235, 0), Vector3(7, -4.235, 0)] +} + +[sub_resource type="Animation" id="Animation_jtts3"] +length = 0.001 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath(".:position") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Vector3(-7, -4.235, 0)] +} + +[sub_resource type="AnimationLibrary" id="AnimationLibrary_jtts3"] +_data = { +&"Move": SubResource("9"), +&"RESET": SubResource("Animation_jtts3") +} [node name="Test2" type="Node3D"] script = ExtResource("2") @@ -38,9 +72,6 @@ offset_top = 78.0 offset_right = 171.0 offset_bottom = 92.0 text = "Body Type: " -__meta__ = { -"_edit_use_anchors_": false -} [node name="Options" parent="." instance=ExtResource("3")] offset_top = 153.0 @@ -59,24 +90,29 @@ use_snap = true [node name="Capsule" type="CollisionShape3D" parent="Bodies/CharacterBody3D"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.8, 0) shape = SubResource("1") +debug_color = Color(1, 1, 0, 1) [node name="Box" type="CollisionShape3D" parent="Bodies/CharacterBody3D"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.8, 0) shape = SubResource("2") +debug_color = Color(1, 1, 0, 1) [node name="Cylinder" type="CollisionShape3D" parent="Bodies/CharacterBody3D"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.8, 0) shape = SubResource("3") +debug_color = Color(1, 1, 0, 1) [node name="Sphere" type="CollisionShape3D" parent="Bodies/CharacterBody3D"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.8, 0) shape = SubResource("4") +debug_color = Color(1, 1, 0, 1) [node name="Convex" type="CollisionShape3D" parent="Bodies/CharacterBody3D"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.8, 0) shape = SubResource("5") +debug_color = Color(1, 1, 0, 1) -[node name="RigidBody" type="RigidDynamicBody3D" parent="Bodies"] +[node name="RigidBody" type="RigidBody3D" parent="Bodies"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -7, -4.18538, 0) collision_layer = 4 axis_lock_angular_x = true @@ -87,22 +123,27 @@ physics_material_override = SubResource("7") [node name="Capsule" type="CollisionShape3D" parent="Bodies/RigidBody"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.8, 0) shape = SubResource("1") +debug_color = Color(1, 1, 0, 1) [node name="Box" type="CollisionShape3D" parent="Bodies/RigidBody"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.8, 0) shape = SubResource("2") +debug_color = Color(1, 1, 0, 1) [node name="Cylinder" type="CollisionShape3D" parent="Bodies/RigidBody"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.8, 0) shape = SubResource("3") +debug_color = Color(1, 1, 0, 1) [node name="Sphere" type="CollisionShape3D" parent="Bodies/RigidBody"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.8, 0) shape = SubResource("4") +debug_color = Color(1, 1, 0, 1) [node name="Convex" type="CollisionShape3D" parent="Bodies/RigidBody"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.8, 0) shape = SubResource("5") +debug_color = Color(1, 1, 0, 1) [node name="Platforms" type="Node3D" parent="."] @@ -112,14 +153,14 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -7, -4.235, 0) [node name="CollisionShape" type="CollisionShape3D" parent="Platforms/MovingPlatform"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.2, 0) shape = SubResource("8") +debug_color = Color(0.533333, 0, 1, 1) [node name="AnimationPlayer" type="AnimationPlayer" parent="Platforms/MovingPlatform"] -anims/Move = SubResource("9") +libraries = { +&"": SubResource("AnimationLibrary_jtts3") +} [node name="Camera3D" type="Camera3D" parent="."] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 10) current = true script = ExtResource("1") - -[node name="OmniLight" type="OmniLight3D" parent="Camera3D"] -omni_range = 50.0 diff --git a/3d/physics_tests/tests/functional/test_raycasting.gd b/3d/physics_tests/tests/functional/test_raycasting.gd index 75fd83c5..78e8c0d6 100644 --- a/3d/physics_tests/tests/functional/test_raycasting.gd +++ b/3d/physics_tests/tests/functional/test_raycasting.gd @@ -88,7 +88,7 @@ func _add_raycast(space_state: PhysicsDirectSpaceState3D, pos_start: Vector3, po if result: _raycast_visuals.surface_set_color(Color.GREEN) else: - _raycast_visuals.surface_set_color(Color.RED.darkened(0.5)) + _raycast_visuals.surface_set_color(Color.BLACK) # Draw raycast line. _raycast_visuals.surface_add_vertex(pos_start) diff --git a/3d/physics_tests/tests/functional/test_raycasting.tscn b/3d/physics_tests/tests/functional/test_raycasting.tscn index 3d7afdf8..b2d68bd2 100644 --- a/3d/physics_tests/tests/functional/test_raycasting.tscn +++ b/3d/physics_tests/tests/functional/test_raycasting.tscn @@ -27,44 +27,49 @@ theme_override_font_sizes/font_size = 16 [node name="Shapes" type="Node3D" parent="."] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 9.35591, 0) -[node name="RigidBodyBox" type="RigidDynamicBody3D" parent="Shapes"] +[node name="RigidBodyBox" type="RigidBody3D" parent="Shapes"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -6, 0, 0) freeze = true [node name="CollisionShape" type="CollisionShape3D" parent="Shapes/RigidBodyBox"] transform = Transform3D(0.579556, 0.0885213, 0.145926, 0, 0.939693, -0.205212, -0.155291, 0.330366, 0.544604, 0, 0, 0) shape = SubResource("1") +debug_color = Color(1, 1, 0, 1) -[node name="RigidBodySphere" type="RigidDynamicBody3D" parent="Shapes"] +[node name="RigidBodySphere" type="RigidBody3D" parent="Shapes"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -3, 0, 0) freeze = true [node name="CollisionShape" type="CollisionShape3D" parent="Shapes/RigidBodySphere"] transform = Transform3D(1.2, 0, 0, 0, 1.2, 0, 0, 0, 1.2, 0, 0, 0) shape = SubResource("2") +debug_color = Color(1, 1, 0, 1) -[node name="RigidBodyCapsule" type="RigidDynamicBody3D" parent="Shapes"] +[node name="RigidBodyCapsule" type="RigidBody3D" parent="Shapes"] freeze = true [node name="CollisionShape" type="CollisionShape3D" parent="Shapes/RigidBodyCapsule"] transform = Transform3D(0.8, 0, 0, 0, 0.8, 0, 0, 0, 0.8, 0, 0, 0) shape = SubResource("3") +debug_color = Color(1, 1, 0, 1) -[node name="RigidBodyCylinder" type="RigidDynamicBody3D" parent="Shapes"] +[node name="RigidBodyCylinder" type="RigidBody3D" parent="Shapes"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 3, 0, 0) freeze = true [node name="CollisionShape" type="CollisionShape3D" parent="Shapes/RigidBodyCylinder"] transform = Transform3D(0.772741, -0.258819, 2.59821e-08, 0.2, 0.933013, -0.207055, 0.0535898, 0.25, 0.772741, 0, 0, 0) shape = SubResource("4") +debug_color = Color(1, 1, 0, 1) -[node name="RigidBodyConvexPolygon" type="RigidDynamicBody3D" parent="Shapes"] +[node name="RigidBodyConvexPolygon" type="RigidBody3D" parent="Shapes"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 6, -0.211, 0) freeze = true [node name="CollisionShape" type="CollisionShape3D" parent="Shapes/RigidBodyConvexPolygon"] transform = Transform3D(2, 0, 0, 0, 2.89766, -0.517939, 0, 0.776908, 1.93177, 0, 0.3533, 0) shape = SubResource("5") +debug_color = Color(1, 1, 0, 1) [node name="StaticBodyHead" type="StaticBody3D" parent="Shapes"] transform = Transform3D(2, 0, 0, 0, 2, 0, 0, 0, 2, 0, -6, 3.93357) @@ -72,6 +77,7 @@ transform = Transform3D(2, 0, 0, 0, 2, 0, 0, 0, 2, 0, -6, 3.93357) [node name="CollisionShape" type="CollisionShape3D" parent="Shapes/StaticBodyHead"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1, 0) shape = ExtResource("1") +debug_color = Color(0, 0.533333, 1, 1) [node name="Camera3D" type="Camera3D" parent="."] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 5.8667, 11.8164) diff --git a/3d/physics_tests/tests/functional/test_rigidbody_ground_check.tscn b/3d/physics_tests/tests/functional/test_rigidbody_ground_check.tscn index 760787bb..0a36c655 100644 --- a/3d/physics_tests/tests/functional/test_rigidbody_ground_check.tscn +++ b/3d/physics_tests/tests/functional/test_rigidbody_ground_check.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=28 format=3 uid="uid://se7gyhmygqul"] +[gd_scene load_steps=23 format=3 uid="uid://se7gyhmygqul"] [ext_resource type="Script" uid="uid://4rx7rkakkj28" path="res://utils/rigidbody_ground_check.gd" id="1"] [ext_resource type="PackedScene" uid="uid://b1ihqm3x8jru" path="res://tests/test_options.tscn" id="2"] @@ -10,47 +10,27 @@ friction = 0.0 [sub_resource type="BoxShape3D" id="2"] -[sub_resource type="BoxMesh" id="3"] - [sub_resource type="PhysicsMaterial" id="5"] friction = 0.0 [sub_resource type="CapsuleShape3D" id="6"] -[sub_resource type="CapsuleMesh" id="7"] - [sub_resource type="PhysicsMaterial" id="9"] friction = 0.0 [sub_resource type="CylinderShape3D" id="10"] -[sub_resource type="CylinderMesh" id="11"] - [sub_resource type="PhysicsMaterial" id="13"] friction = 0.0 [sub_resource type="ConvexPolygonShape3D" id="14"] points = PackedVector3Array(-0.7, 0, -0.7, -0.3, 0, 0.8, 0.8, 0, -0.3, 0, -1, 0) -[sub_resource type="ArrayMesh" id="15"] -_surfaces = [{ -"aabb": AABB(-0.7, -1, -0.7, 1.5, 1.00001, 1.5), -"format": 34359742467, -"index_count": 12, -"index_data": PackedByteArray(0, 0, 1, 0, 3, 0, 1, 0, 2, 0, 3, 0, 2, 0, 0, 0, 3, 0, 2, 0, 1, 0, 0, 0), -"primitive": 3, -"uv_scale": Vector4(0, 0, 0, 0), -"vertex_count": 4, -"vertex_data": PackedByteArray(51, 51, 51, 191, 0, 0, 0, 0, 51, 51, 51, 191, 154, 153, 153, 190, 0, 0, 0, 0, 205, 204, 76, 63, 205, 204, 76, 63, 0, 0, 0, 0, 154, 153, 153, 190, 0, 0, 0, 0, 0, 0, 128, 191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 96, 59, 182, 3, 0, 0, 0, 0, 0, 0) -}] - [sub_resource type="PhysicsMaterial" id="17"] friction = 0.0 [sub_resource type="SphereShape3D" id="18"] -[sub_resource type="SphereMesh" id="19"] - [sub_resource type="PlaneMesh" id="23"] size = Vector2(50, 20) @@ -106,9 +86,7 @@ script = ExtResource("1") [node name="CollisionShape" type="CollisionShape3D" parent="DynamicShapes/Bodies/RigidBodyBox"] transform = Transform3D(0.6, 0, 0, 0, 1, 0, 0, 0, 0.6, 0, 0, 0) shape = SubResource("2") - -[node name="MeshInstance3D" type="MeshInstance3D" parent="DynamicShapes/Bodies/RigidBodyBox/CollisionShape"] -mesh = SubResource("3") +debug_color = Color(1, 1, 0, 1) [node name="RigidBodyCapsule" type="RigidBody3D" parent="DynamicShapes/Bodies"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -3, 0, 0) @@ -121,9 +99,7 @@ script = ExtResource("1") [node name="CollisionShape" type="CollisionShape3D" parent="DynamicShapes/Bodies/RigidBodyCapsule"] transform = Transform3D(0.8, 0, 0, 0, 0.8, 0, 0, 0, 0.8, 0, 0, 0) shape = SubResource("6") - -[node name="MeshInstance3D" type="MeshInstance3D" parent="DynamicShapes/Bodies/RigidBodyCapsule/CollisionShape"] -mesh = SubResource("7") +debug_color = Color(1, 1, 0, 1) [node name="RigidBodyCylinder" type="RigidBody3D" parent="DynamicShapes/Bodies"] axis_lock_angular_x = true @@ -135,9 +111,7 @@ script = ExtResource("1") [node name="CollisionShape" type="CollisionShape3D" parent="DynamicShapes/Bodies/RigidBodyCylinder"] transform = Transform3D(0.8, 0, 0, 0, 1, 0, 0, 0, 0.8, 0, 0, 0) shape = SubResource("10") - -[node name="MeshInstance3D" type="MeshInstance3D" parent="DynamicShapes/Bodies/RigidBodyCylinder/CollisionShape"] -mesh = SubResource("11") +debug_color = Color(1, 1, 0, 1) [node name="RigidBodyConvex" type="RigidBody3D" parent="DynamicShapes/Bodies"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 3, 0.974548, 0) @@ -150,9 +124,7 @@ script = ExtResource("1") [node name="CollisionShape" type="CollisionShape3D" parent="DynamicShapes/Bodies/RigidBodyConvex"] transform = Transform3D(1.5, 0, 0, 0, 2, 0, 0, 0, 1.5, 0, 0, 0) shape = SubResource("14") - -[node name="MeshInstance3D" type="MeshInstance3D" parent="DynamicShapes/Bodies/RigidBodyConvex/CollisionShape"] -mesh = SubResource("15") +debug_color = Color(1, 1, 0, 1) [node name="RigidBodySphere" type="RigidBody3D" parent="DynamicShapes/Bodies"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 6, 0, 0) @@ -165,9 +137,7 @@ script = ExtResource("1") [node name="CollisionShape" type="CollisionShape3D" parent="DynamicShapes/Bodies/RigidBodySphere"] transform = Transform3D(0.8, 0, 0, 0, 0.8, 0, 0, 0, 0.8, 0, 0, 0) shape = SubResource("18") - -[node name="MeshInstance3D" type="MeshInstance3D" parent="DynamicShapes/Bodies/RigidBodySphere/CollisionShape"] -mesh = SubResource("19") +debug_color = Color(1, 1, 0, 1) [node name="Floors" type="Node3D" parent="."] @@ -182,6 +152,7 @@ mesh = SubResource("23") [node name="CollisionShape" type="CollisionShape3D" parent="Floors/ConvexSmall/ConvexFloor"] shape = SubResource("24") +debug_color = Color(0, 0.533333, 1, 1) [node name="ConvexFloor2" type="StaticBody3D" parent="Floors/ConvexSmall"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 10) @@ -192,6 +163,7 @@ mesh = SubResource("23") [node name="CollisionShape" type="CollisionShape3D" parent="Floors/ConvexSmall/ConvexFloor2"] shape = SubResource("25") +debug_color = Color(0, 0.533333, 1, 1) [node name="ConvexBig" type="Node3D" parent="Floors"] @@ -203,6 +175,7 @@ mesh = SubResource("23") [node name="CollisionShape" type="CollisionShape3D" parent="Floors/ConvexBig/ConvexFloor"] shape = SubResource("26") +debug_color = Color(0, 0.533333, 1, 1) [node name="ConcaveSmall" type="Node3D" parent="Floors"] @@ -216,6 +189,7 @@ mesh = SubResource("23") [node name="CollisionShape" type="CollisionShape3D" parent="Floors/ConcaveSmall/ConcaveFloor"] transform = Transform3D(25, 0, 0, 0, 1, 0, 0, 0, 10, 0, 0, 0) shape = SubResource("27") +debug_color = Color(0, 0.533333, 1, 1) [node name="ConcaveFloor2" type="StaticBody3D" parent="Floors/ConcaveSmall"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 10) @@ -227,6 +201,7 @@ mesh = SubResource("23") [node name="CollisionShape" type="CollisionShape3D" parent="Floors/ConcaveSmall/ConcaveFloor2"] transform = Transform3D(25, 0, 0, 0, 1, 0, 0, 0, 10, 0, 0, 0) shape = SubResource("27") +debug_color = Color(0, 0.533333, 1, 1) [node name="ConcaveBig" type="Node3D" parent="Floors"] @@ -238,6 +213,7 @@ mesh = SubResource("23") [node name="CollisionShape" type="CollisionShape3D" parent="Floors/ConcaveBig/ConcaveFloor"] shape = SubResource("28") +debug_color = Color(0, 0.533333, 1, 1) [node name="BoxSmall" type="Node3D" parent="Floors"] @@ -251,6 +227,7 @@ mesh = SubResource("23") [node name="CollisionShape" type="CollisionShape3D" parent="Floors/BoxSmall/BoxFloor"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1, 0) shape = SubResource("29") +debug_color = Color(0, 0.533333, 1, 1) [node name="BoxFloor2" type="StaticBody3D" parent="Floors/BoxSmall"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 10) @@ -262,6 +239,7 @@ mesh = SubResource("23") [node name="CollisionShape" type="CollisionShape3D" parent="Floors/BoxSmall/BoxFloor2"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1, 0) shape = SubResource("29") +debug_color = Color(0, 0.533333, 1, 1) [node name="BoxBig" type="Node3D" parent="Floors"] @@ -274,12 +252,9 @@ mesh = SubResource("23") [node name="CollisionShape" type="CollisionShape3D" parent="Floors/BoxBig/BoxFloor"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1, 0) shape = SubResource("30") +debug_color = Color(0, 0.533333, 1, 1) [node name="Camera3D" type="Camera3D" parent="."] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 3.604, 22.124) far = 1000.0 script = ExtResource("4") - -[node name="OmniLight" type="OmniLight3D" parent="Camera3D"] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 14.6965, -5.95932) -omni_range = 50.0 diff --git a/3d/physics_tests/tests/functional/test_rigidbody_impact.tscn b/3d/physics_tests/tests/functional/test_rigidbody_impact.tscn index 7cb74650..2f2a621c 100644 --- a/3d/physics_tests/tests/functional/test_rigidbody_impact.tscn +++ b/3d/physics_tests/tests/functional/test_rigidbody_impact.tscn @@ -22,7 +22,7 @@ script = ExtResource("2") [node name="DynamicShapes" type="Node3D" parent="."] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 9.35591, 0) -[node name="RigidBodyBox" type="RigidDynamicBody3D" parent="DynamicShapes"] +[node name="RigidBodyBox" type="RigidBody3D" parent="DynamicShapes"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -6, 1, 0) axis_lock_angular_x = true axis_lock_angular_y = true @@ -32,8 +32,9 @@ script = ExtResource("1") [node name="CollisionShape" type="CollisionShape3D" parent="DynamicShapes/RigidBodyBox"] transform = Transform3D(0.6, 0, 0, 0, 1, 0, 0, 0, 0.6, 0, 0, 0) shape = SubResource("1") +debug_color = Color(1, 1, 0, 1) -[node name="RigidBodyCapsule" type="RigidDynamicBody3D" parent="DynamicShapes"] +[node name="RigidBodyCapsule" type="RigidBody3D" parent="DynamicShapes"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -3, 1.0034, 0) axis_lock_angular_x = true axis_lock_angular_y = true @@ -43,8 +44,9 @@ script = ExtResource("1") [node name="CollisionShape" type="CollisionShape3D" parent="DynamicShapes/RigidBodyCapsule"] transform = Transform3D(0.8, 0, 0, 0, 0.8, 0, 0, 0, 0.8, 0, 0, 0) shape = SubResource("2") +debug_color = Color(1, 1, 0, 1) -[node name="RigidBodyCylinder" type="RigidDynamicBody3D" parent="DynamicShapes"] +[node name="RigidBodyCylinder" type="RigidBody3D" parent="DynamicShapes"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.0034, 0) axis_lock_angular_x = true axis_lock_angular_y = true @@ -54,8 +56,9 @@ script = ExtResource("1") [node name="CollisionShape" type="CollisionShape3D" parent="DynamicShapes/RigidBodyCylinder"] transform = Transform3D(0.8, 0, 0, 0, 1, 0, 0, 0, 0.8, 0, 0, 0) shape = SubResource("3") +debug_color = Color(1, 1, 0, 1) -[node name="RigidBodyConvex" type="RigidDynamicBody3D" parent="DynamicShapes"] +[node name="RigidBodyConvex" type="RigidBody3D" parent="DynamicShapes"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 3, 1.97795, 0) axis_lock_angular_x = true axis_lock_angular_y = true @@ -65,8 +68,9 @@ script = ExtResource("1") [node name="CollisionShape" type="CollisionShape3D" parent="DynamicShapes/RigidBodyConvex"] transform = Transform3D(1.5, 0, 0, 0, 2, 0, 0, 0, 1.5, 0, 0, 0) shape = SubResource("4") +debug_color = Color(1, 1, 0, 1) -[node name="RigidBodySphere" type="RigidDynamicBody3D" parent="DynamicShapes"] +[node name="RigidBodySphere" type="RigidBody3D" parent="DynamicShapes"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 6, 1, 0) axis_lock_angular_x = true axis_lock_angular_y = true @@ -76,6 +80,7 @@ script = ExtResource("1") [node name="CollisionShape" type="CollisionShape3D" parent="DynamicShapes/RigidBodySphere"] transform = Transform3D(0.8, 0, 0, 0, 0.8, 0, 0, 0, 0.8, 0, 0, 0) shape = SubResource("5") +debug_color = Color(1, 1, 0, 1) [node name="StaticBodyPlane" parent="." instance=ExtResource("3")] @@ -83,6 +88,3 @@ shape = SubResource("5") transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 3.604, 22.124) fov = 35.0 script = ExtResource("4") - -[node name="OmniLight" type="OmniLight3D" parent="Camera3D"] -omni_range = 50.0 diff --git a/3d/physics_tests/tests/functional/test_shapes.tscn b/3d/physics_tests/tests/functional/test_shapes.tscn index f7ef93cb..04db9e09 100644 --- a/3d/physics_tests/tests/functional/test_shapes.tscn +++ b/3d/physics_tests/tests/functional/test_shapes.tscn @@ -22,50 +22,52 @@ script = ExtResource("2") [node name="DynamicShapes" type="Node3D" parent="."] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 9.35591, 0) -[node name="RigidBodyBox" type="RigidDynamicBody3D" parent="DynamicShapes"] +[node name="RigidBodyBox" type="RigidBody3D" parent="DynamicShapes"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -6, 0, 0) script = ExtResource("1") [node name="CollisionShape" type="CollisionShape3D" parent="DynamicShapes/RigidBodyBox"] transform = Transform3D(0.579556, 0.0885213, 0.145926, 0, 0.939693, -0.205212, -0.155291, 0.330366, 0.544604, 0, 0, 0) shape = SubResource("1") +debug_color = Color(1, 1, 0, 1) -[node name="RigidBodyCapsule" type="RigidDynamicBody3D" parent="DynamicShapes"] +[node name="RigidBodyCapsule" type="RigidBody3D" parent="DynamicShapes"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -3, 0, 0) script = ExtResource("1") [node name="CollisionShape" type="CollisionShape3D" parent="DynamicShapes/RigidBodyCapsule"] transform = Transform3D(0.8, 0, 0, 0, 0.8, 0, 0, 0, 0.8, 0, 0, 0) shape = SubResource("2") +debug_color = Color(1, 1, 0, 1) -[node name="RigidBodyCylinder" type="RigidDynamicBody3D" parent="DynamicShapes"] +[node name="RigidBodyCylinder" type="RigidBody3D" parent="DynamicShapes"] script = ExtResource("1") [node name="CollisionShape" type="CollisionShape3D" parent="DynamicShapes/RigidBodyCylinder"] transform = Transform3D(0.772741, -0.258819, 2.59821e-08, 0.2, 0.933013, -0.207055, 0.0535898, 0.25, 0.772741, 0, 0, 0) shape = SubResource("3") +debug_color = Color(1, 1, 0, 1) -[node name="RigidBodyConvex" type="RigidDynamicBody3D" parent="DynamicShapes"] +[node name="RigidBodyConvex" type="RigidBody3D" parent="DynamicShapes"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 3, 0, 0) script = ExtResource("1") [node name="CollisionShape" type="CollisionShape3D" parent="DynamicShapes/RigidBodyConvex"] transform = Transform3D(1.5, 0, 0, 0, 1.93185, -0.388229, 0, 0.517638, 1.44889, 0, 0, 0) shape = SubResource("4") +debug_color = Color(1, 1, 0, 1) -[node name="RigidBodySphere" type="RigidDynamicBody3D" parent="DynamicShapes"] +[node name="RigidBodySphere" type="RigidBody3D" parent="DynamicShapes"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 6, 0, 0) script = ExtResource("1") [node name="CollisionShape" type="CollisionShape3D" parent="DynamicShapes/RigidBodySphere"] transform = Transform3D(0.8, 0, 0, 0, 0.8, 0, 0, 0, 0.8, 0, 0, 0) shape = SubResource("5") +debug_color = Color(1, 1, 0, 1) [node name="StaticScene" parent="." instance=ExtResource("6")] [node name="Camera3D" type="Camera3D" parent="."] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 4.53602, 22.1236) script = ExtResource("4") - -[node name="OmniLight" type="OmniLight3D" parent="Camera3D"] -omni_range = 50.0 diff --git a/3d/physics_tests/tests/performance/test_perf_broadphase.tscn b/3d/physics_tests/tests/performance/test_perf_broadphase.tscn index ae920001..09b39812 100644 --- a/3d/physics_tests/tests/performance/test_perf_broadphase.tscn +++ b/3d/physics_tests/tests/performance/test_perf_broadphase.tscn @@ -4,9 +4,9 @@ [node name="Test" type="Node3D"] script = ExtResource("1") -_enable_debug_collision = false row_size = 50 column_size = 50 depth_size = 50 +_enable_debug_collision = false [node name="Objects" type="Node3D" parent="."] diff --git a/3d/physics_tests/tests/performance/test_perf_contact_islands.tscn b/3d/physics_tests/tests/performance/test_perf_contact_islands.tscn index 258d3e0f..37e6f63e 100644 --- a/3d/physics_tests/tests/performance/test_perf_contact_islands.tscn +++ b/3d/physics_tests/tests/performance/test_perf_contact_islands.tscn @@ -20,10 +20,10 @@ points = PackedVector3Array(-0.7, 0, -0.7, -0.3, 0, 0.8, 0.8, 0, -0.3, 0, -1, 0) [node name="Test" type="Node3D"] script = ExtResource("1") -_enable_debug_collision = false -spawns = ["SpawnTarget1", "SpawnTarget2", "SpawnTarget3", "SpawnTarget4", "SpawnTarget5", "SpawnTarget6", "SpawnTarget7", "SpawnTarget8", "SpawnTarget9", "SpawnTarget10", "SpawnTarget11", "SpawnTarget12", "SpawnTarget13", "SpawnTarget14", "SpawnTarget15", "SpawnTarget16"] +spawns = Array[NodePath]([NodePath("SpawnTarget1"), NodePath("SpawnTarget2"), NodePath("SpawnTarget3"), NodePath("SpawnTarget4"), NodePath("SpawnTarget5"), NodePath("SpawnTarget6"), NodePath("SpawnTarget7"), NodePath("SpawnTarget8"), NodePath("SpawnTarget9"), NodePath("SpawnTarget10"), NodePath("SpawnTarget11"), NodePath("SpawnTarget12"), NodePath("SpawnTarget13"), NodePath("SpawnTarget14"), NodePath("SpawnTarget15"), NodePath("SpawnTarget16")]) spawn_count = 200 spawn_randomize = Vector3(0.2, 0.2, 0.2) +_enable_debug_collision = false [node name="Options" parent="." instance=ExtResource("4")] @@ -78,35 +78,40 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -38.368, 7, -20.8078) [node name="DynamicShapes" type="Node3D" parent="."] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -26.3192, 1.2359, 38.0117) -[node name="RigidBodyBox" type="RigidDynamicBody3D" parent="DynamicShapes"] +[node name="RigidBodyBox" type="RigidBody3D" parent="DynamicShapes"] [node name="CollisionShape" type="CollisionShape3D" parent="DynamicShapes/RigidBodyBox"] shape = SubResource("1") +debug_color = Color(1, 1, 0, 1) -[node name="RigidBodyCapsule" type="RigidDynamicBody3D" parent="DynamicShapes"] +[node name="RigidBodyCapsule" type="RigidBody3D" parent="DynamicShapes"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2, 0, 0) [node name="CollisionShape" type="CollisionShape3D" parent="DynamicShapes/RigidBodyCapsule"] shape = SubResource("2") +debug_color = Color(1, 1, 0, 1) -[node name="RigidBodyCylinder" type="RigidDynamicBody3D" parent="DynamicShapes"] +[node name="RigidBodyCylinder" type="RigidBody3D" parent="DynamicShapes"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 4, 0, 0) [node name="CollisionShape" type="CollisionShape3D" parent="DynamicShapes/RigidBodyCylinder"] shape = SubResource("3") +debug_color = Color(1, 1, 0, 1) -[node name="RigidBodyConvex" type="RigidDynamicBody3D" parent="DynamicShapes"] +[node name="RigidBodyConvex" type="RigidBody3D" parent="DynamicShapes"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 6, 0, 0) [node name="CollisionShape" type="CollisionShape3D" parent="DynamicShapes/RigidBodyConvex"] transform = Transform3D(0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 0, 0, 0) shape = SubResource("4") +debug_color = Color(1, 1, 0, 1) -[node name="RigidBodySphere" type="RigidDynamicBody3D" parent="DynamicShapes"] +[node name="RigidBodySphere" type="RigidBody3D" parent="DynamicShapes"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 8, 0, 0) [node name="CollisionShape" type="CollisionShape3D" parent="DynamicShapes/RigidBodySphere"] shape = SubResource("5") +debug_color = Color(1, 1, 0, 1) [node name="StaticScene" parent="." instance=ExtResource("5")] @@ -115,22 +120,23 @@ shape = SubResource("5") [node name="CollisionShape1" type="CollisionShape3D" parent="StaticBodyWalls"] transform = Transform3D(-1.62921e-07, 1, 0, -1, -1.62921e-07, 0, 0, 0, 1, -50, 0, 0) shape = SubResource("6") +debug_color = Color(0, 0.533333, 1, 1) [node name="CollisionShape2" type="CollisionShape3D" parent="StaticBodyWalls"] transform = Transform3D(-1.62921e-07, -1, 0, 1, -1.62921e-07, 0, 0, 0, 1, 50, 0, 0) shape = SubResource("6") +debug_color = Color(0, 0.533333, 1, 1) [node name="CollisionShape3" type="CollisionShape3D" parent="StaticBodyWalls"] transform = Transform3D(2.6543e-14, 1.62921e-07, 1, 1, -1.62921e-07, 1.56125e-19, 1.62921e-07, 1, -1.62921e-07, 0, 0, -50) shape = SubResource("6") +debug_color = Color(0, 0.533333, 1, 1) [node name="CollisionShape4" type="CollisionShape3D" parent="StaticBodyWalls"] transform = Transform3D(2.6543e-14, 1.62921e-07, -1, 1, -1.62921e-07, -1.56125e-19, -1.62921e-07, -1, -1.62921e-07, 0, 0, 50) shape = SubResource("6") +debug_color = Color(0, 0.533333, 1, 1) [node name="Camera3D" type="Camera3D" parent="."] transform = Transform3D(1, 0, 0, 0, 0.881757, 0.471705, 0, -0.471705, 0.881757, 0, 20.4125, 41.0426) script = ExtResource("3") - -[node name="OmniLight" type="OmniLight3D" parent="Camera3D"] -omni_range = 80.0 diff --git a/3d/physics_tests/tests/performance/test_perf_contacts.tscn b/3d/physics_tests/tests/performance/test_perf_contacts.tscn index 8a0670cd..1769515b 100644 --- a/3d/physics_tests/tests/performance/test_perf_contacts.tscn +++ b/3d/physics_tests/tests/performance/test_perf_contacts.tscn @@ -20,10 +20,10 @@ points = PackedVector3Array(-0.7, 0, -0.7, -0.3, 0, 0.8, 0.8, 0, -0.3, 0, -1, 0) [node name="Test" type="Node3D"] script = ExtResource("2") -_enable_debug_collision = false -spawns = ["SpawnTarget1"] +spawns = Array[NodePath]([NodePath("SpawnTarget1")]) spawn_count = 500 spawn_randomize = Vector3(0.2, 0.2, 0.2) +_enable_debug_collision = false [node name="Options" parent="." instance=ExtResource("4")] @@ -33,58 +33,64 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 7.06418, -1.24693) [node name="DynamicShapes" type="Node3D" parent="."] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -26.3192, 1.2359, 38.0117) -[node name="RigidBodyBox" type="RigidDynamicBody3D" parent="DynamicShapes"] +[node name="RigidBodyBox" type="RigidBody3D" parent="DynamicShapes"] [node name="CollisionShape" type="CollisionShape3D" parent="DynamicShapes/RigidBodyBox"] shape = SubResource("1") +debug_color = Color(1, 1, 0, 1) -[node name="RigidBodyCapsule" type="RigidDynamicBody3D" parent="DynamicShapes"] +[node name="RigidBodyCapsule" type="RigidBody3D" parent="DynamicShapes"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2, 0, 0) [node name="CollisionShape" type="CollisionShape3D" parent="DynamicShapes/RigidBodyCapsule"] shape = SubResource("2") +debug_color = Color(1, 1, 0, 1) -[node name="RigidBodyCylinder" type="RigidDynamicBody3D" parent="DynamicShapes"] +[node name="RigidBodyCylinder" type="RigidBody3D" parent="DynamicShapes"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 4, 0, 0) [node name="CollisionShape" type="CollisionShape3D" parent="DynamicShapes/RigidBodyCylinder"] shape = SubResource("3") +debug_color = Color(1, 1, 0, 1) -[node name="RigidBodyConvex" type="RigidDynamicBody3D" parent="DynamicShapes"] +[node name="RigidBodyConvex" type="RigidBody3D" parent="DynamicShapes"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 6, 0, 0) [node name="CollisionShape" type="CollisionShape3D" parent="DynamicShapes/RigidBodyConvex"] shape = SubResource("4") +debug_color = Color(1, 1, 0, 1) -[node name="RigidBodySphere" type="RigidDynamicBody3D" parent="DynamicShapes"] +[node name="RigidBodySphere" type="RigidBody3D" parent="DynamicShapes"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 8, 0, 0) [node name="CollisionShape" type="CollisionShape3D" parent="DynamicShapes/RigidBodySphere"] shape = SubResource("5") +debug_color = Color(1, 1, 0, 1) [node name="StaticBodyWalls" type="StaticBody3D" parent="."] [node name="CollisionShape1" type="CollisionShape3D" parent="StaticBodyWalls"] transform = Transform3D(-1.62921e-07, 1, 0, -1, -1.62921e-07, 0, 0, 0, 1, -5, 0, 0) shape = SubResource("6") +debug_color = Color(0, 0.533333, 1, 1) [node name="CollisionShape2" type="CollisionShape3D" parent="StaticBodyWalls"] transform = Transform3D(-1.62921e-07, -1, 0, 1, -1.62921e-07, 0, 0, 0, 1, 5, 0, 0) shape = SubResource("6") +debug_color = Color(0, 0.533333, 1, 1) [node name="CollisionShape3" type="CollisionShape3D" parent="StaticBodyWalls"] transform = Transform3D(2.6543e-14, 1.62921e-07, 1, 1, -1.62921e-07, 1.56125e-19, 1.62921e-07, 1, -1.62921e-07, 0, 0, -5) shape = SubResource("6") +debug_color = Color(0, 0.533333, 1, 1) [node name="CollisionShape4" type="CollisionShape3D" parent="StaticBodyWalls"] transform = Transform3D(2.6543e-14, 1.62921e-07, -1, 1, -1.62921e-07, -1.56125e-19, -1.62921e-07, -1, -1.62921e-07, 0, 0, 5) shape = SubResource("6") +debug_color = Color(0, 0.533333, 1, 1) [node name="StaticScene" parent="." instance=ExtResource("1")] [node name="Camera3D" type="Camera3D" parent="."] transform = Transform3D(1, 0, 0, 0, 0.881757, 0.471705, 0, -0.471705, 0.881757, 0, 20.4125, 41.0426) script = ExtResource("5") - -[node name="OmniLight" type="OmniLight3D" parent="Camera3D"] -omni_range = 80.0 diff --git a/3d/physics_tests/tests/static_scene.tscn b/3d/physics_tests/tests/static_scene.tscn index 9bcded0b..7eefc5a2 100644 --- a/3d/physics_tests/tests/static_scene.tscn +++ b/3d/physics_tests/tests/static_scene.tscn @@ -1,7 +1,6 @@ -[gd_scene load_steps=4 format=3 uid="uid://cl2vpuxqgnylc"] +[gd_scene load_steps=3 format=3 uid="uid://cl2vpuxqgnylc"] [ext_resource type="Shape3D" path="res://assets/robot_head/godot3_robot_head_collision.tres" id="1"] -[ext_resource type="ArrayMesh" path="res://assets/robot_head/godot3_robot_head.mesh" id="2"] [ext_resource type="PackedScene" uid="uid://3gkujifjokqw" path="res://tests/static_scene_plane.tscn" id="3"] [node name="StaticScene" type="Node3D"] @@ -11,8 +10,6 @@ [node name="StaticBodyHead" type="StaticBody3D" parent="."] transform = Transform3D(10, 0, 0, 0, 8.66025, 5, 0, -5, 8.66025, 0, -11.1389, 2.29332) -[node name="RobotHead" type="MeshInstance3D" parent="StaticBodyHead"] -mesh = ExtResource("2") - [node name="CollisionShape" type="CollisionShape3D" parent="StaticBodyHead"] shape = ExtResource("1") +debug_color = Color(0, 0.533333, 1, 1) diff --git a/3d/physics_tests/tests/static_scene_plane.tscn b/3d/physics_tests/tests/static_scene_plane.tscn index 49cd9391..266e06f6 100644 --- a/3d/physics_tests/tests/static_scene_plane.tscn +++ b/3d/physics_tests/tests/static_scene_plane.tscn @@ -1,16 +1,11 @@ -[gd_scene load_steps=3 format=3 uid="uid://3gkujifjokqw"] - -[sub_resource type="PlaneMesh" id="1"] +[gd_scene load_steps=2 format=3 uid="uid://3gkujifjokqw"] [sub_resource type="ConcavePolygonShape3D" id="2"] data = PackedVector3Array(-1, 0, 1, 1, 0, -1, 1, 0, 1, -1, 0, 1, -1, 0, -1, 1, 0, -1) [node name="StaticBodyPlane" type="StaticBody3D"] -[node name="MeshInstance3D" type="MeshInstance3D" parent="."] -transform = Transform3D(50, 0, 0, 0, 1, 0, 0, 0, 50, 0, 0, 0) -mesh = SubResource("1") - [node name="CollisionShape" type="CollisionShape3D" parent="."] transform = Transform3D(50, 0, 0, 0, 1, 0, 0, 0, 50, 0, 0, 0) shape = SubResource("2") +debug_color = Color(0, 0.533333, 1, 1) diff --git a/3d/physics_tests/tests/test_options.tscn b/3d/physics_tests/tests/test_options.tscn index 802c82d2..d18872d4 100644 --- a/3d/physics_tests/tests/test_options.tscn +++ b/3d/physics_tests/tests/test_options.tscn @@ -7,9 +7,6 @@ offset_left = 10.0 offset_top = 106.719 offset_right = 125.0 offset_bottom = 126.719 -text = "TEST OPTIONS" +text = "Test Options" flat = false script = ExtResource("1") -__meta__ = { -"_edit_use_anchors_": false -} diff --git a/3d/physics_tests/utils/label_engine.gd b/3d/physics_tests/utils/label_engine.gd index 87ec5dc6..63346ffc 100644 --- a/3d/physics_tests/utils/label_engine.gd +++ b/3d/physics_tests/utils/label_engine.gd @@ -5,6 +5,8 @@ func _ready() -> void: match System.get_physics_engine(): System.PhysicsEngine.GODOT_PHYSICS: engine_name = "GodotPhysics 3D" + System.PhysicsEngine.JOLT_PHYSICS: + engine_name = "Jolt Physics" System.PhysicsEngine.OTHER: var engine_setting := str(ProjectSettings.get_setting("physics/3d/physics_engine")) engine_name = "Other (%s)" % engine_setting diff --git a/3d/physics_tests/utils/max_steps_per_frame.gd b/3d/physics_tests/utils/max_steps_per_frame.gd new file mode 100644 index 00000000..4f03f4b1 --- /dev/null +++ b/3d/physics_tests/utils/max_steps_per_frame.gd @@ -0,0 +1,6 @@ +extends HBoxContainer + + +func _on_h_slider_value_changed(value: float) -> void: + $Value.text = str(roundi(value)) + Engine.max_physics_steps_per_frame = roundi(value) diff --git a/3d/physics_tests/utils/max_steps_per_frame.gd.uid b/3d/physics_tests/utils/max_steps_per_frame.gd.uid new file mode 100644 index 00000000..f057f90d --- /dev/null +++ b/3d/physics_tests/utils/max_steps_per_frame.gd.uid @@ -0,0 +1 @@ +uid://cvoeuonqmsye1 diff --git a/3d/physics_tests/utils/physics_interpolation.gd b/3d/physics_tests/utils/physics_interpolation.gd new file mode 100644 index 00000000..7239a0d9 --- /dev/null +++ b/3d/physics_tests/utils/physics_interpolation.gd @@ -0,0 +1,5 @@ +extends CheckButton + + +func _on_check_button_toggled(toggled_on: bool) -> void: + get_tree().physics_interpolation = toggled_on diff --git a/3d/physics_tests/utils/physics_interpolation.gd.uid b/3d/physics_tests/utils/physics_interpolation.gd.uid new file mode 100644 index 00000000..4b692a22 --- /dev/null +++ b/3d/physics_tests/utils/physics_interpolation.gd.uid @@ -0,0 +1 @@ +uid://ijebwwx4t8et diff --git a/3d/physics_tests/utils/system.gd b/3d/physics_tests/utils/system.gd index af0a233c..b5246233 100644 --- a/3d/physics_tests/utils/system.gd +++ b/3d/physics_tests/utils/system.gd @@ -2,6 +2,7 @@ extends Node enum PhysicsEngine { GODOT_PHYSICS, + JOLT_PHYSICS, OTHER, } @@ -20,6 +21,8 @@ func _enter_tree() -> void: _engine = PhysicsEngine.GODOT_PHYSICS "GodotPhysics3D": _engine = PhysicsEngine.GODOT_PHYSICS + "Jolt Physics": + _engine = PhysicsEngine.JOLT_PHYSICS _: _engine = PhysicsEngine.OTHER diff --git a/3d/physics_tests/utils/ticks_per_second.gd b/3d/physics_tests/utils/ticks_per_second.gd new file mode 100644 index 00000000..a06cfd6e --- /dev/null +++ b/3d/physics_tests/utils/ticks_per_second.gd @@ -0,0 +1,6 @@ +extends HBoxContainer + + +func _on_h_slider_value_changed(value: float) -> void: + $Value.text = str(roundi(value)) + Engine.physics_ticks_per_second = roundi(value * Engine.time_scale) diff --git a/3d/physics_tests/utils/ticks_per_second.gd.uid b/3d/physics_tests/utils/ticks_per_second.gd.uid new file mode 100644 index 00000000..b4904773 --- /dev/null +++ b/3d/physics_tests/utils/ticks_per_second.gd.uid @@ -0,0 +1 @@ +uid://7kql0xtuc7ny diff --git a/3d/physics_tests/utils/time_scale.gd b/3d/physics_tests/utils/time_scale.gd new file mode 100644 index 00000000..938dd78a --- /dev/null +++ b/3d/physics_tests/utils/time_scale.gd @@ -0,0 +1,8 @@ +extends HBoxContainer + + +func _on_h_slider_value_changed(value: float) -> void: + value = maxf(0.1, value) + $Value.text = "%.1f×" % value + Engine.time_scale = value + Engine.physics_ticks_per_second = $"../TicksPerSecond/HSlider".value * value diff --git a/3d/physics_tests/utils/time_scale.gd.uid b/3d/physics_tests/utils/time_scale.gd.uid new file mode 100644 index 00000000..99803db9 --- /dev/null +++ b/3d/physics_tests/utils/time_scale.gd.uid @@ -0,0 +1 @@ +uid://beqnv31yip0bl diff --git a/3d/platformer/project.godot b/3d/platformer/project.godot index acbb89f5..d221cfe7 100644 --- a/3d/platformer/project.godot +++ b/3d/platformer/project.godot @@ -143,6 +143,7 @@ reset_position={ common/physics_ticks_per_second=120 3d/default_gravity=22.0 +3d/physics_engine="Jolt Physics" common/physics_interpolation=true [rendering] diff --git a/3d/rigidbody_character/project.godot b/3d/rigidbody_character/project.godot index 3bf8ec92..fe372e5a 100644 --- a/3d/rigidbody_character/project.godot +++ b/3d/rigidbody_character/project.godot @@ -84,6 +84,7 @@ exit={ common/physics_ticks_per_second=120 3d/default_gravity=13.0 +3d/physics_engine="Jolt Physics" common/physics_interpolation=true [rendering] diff --git a/3d/squash_the_creeps/project.godot b/3d/squash_the_creeps/project.godot index 3b2c64db..859194d2 100644 --- a/3d/squash_the_creeps/project.godot +++ b/3d/squash_the_creeps/project.godot @@ -80,6 +80,7 @@ jump={ [physics] common/physics_ticks_per_second=120 +3d/physics_engine="Jolt Physics" common/physics_interpolation=true [rendering] diff --git a/3d/truck_town/project.godot b/3d/truck_town/project.godot index 8b0ba377..9e149fac 100644 --- a/3d/truck_town/project.godot +++ b/3d/truck_town/project.godot @@ -158,6 +158,7 @@ cycle_mood={ [physics] common/physics_ticks_per_second=120 +3d/physics_engine="Jolt Physics" common/physics_interpolation=true [rendering] diff --git a/3d/voxel/project.godot b/3d/voxel/project.godot index d6a166ca..d1a24729 100644 --- a/3d/voxel/project.godot +++ b/3d/voxel/project.godot @@ -149,6 +149,7 @@ pick_block={ common/physics_ticks_per_second=120 3d/default_gravity=20.0 +3d/physics_engine="Jolt Physics" common/physics_interpolation=true [rendering]