mirror of
https://github.com/godotengine/godot-demo-projects.git
synced 2026-01-06 07:50:22 +01:00
Use Jolt Physics in all 3D demos that use physics, improve physics tests demos (#1195)
- Add options for physics ticks per second, time scale, max physics steps per frame
and physics interpolation to the 2D and 3D physics tests demos.
- Physics ticks per second are always multiplied by time scale so that
time scale does not affect the physics simulation quality.
- Enable 4× MSAA for better debug shape display. Remove meshes/lights as
the debug collision fill make these unnecessary.
- Switch to the Mobile rendering method in the 2D physics tests demo
to allow for 2D MSAA, as it's not implemented in Compatibility yet.
- Improve collision shapes color in the 2D and 3D physics tests demos
for better visibility. Each PhysicsBody type now has its own collision
shape color.
This commit is contained in:
@@ -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
|
||||
|
||||

|
||||

|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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"]
|
||||
|
||||
@@ -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
|
||||
|
||||
BIN
2d/physics_tests/screenshots/physics_tests.webp
Normal file
BIN
2d/physics_tests/screenshots/physics_tests.webp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 53 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 162 KiB |
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"]
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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")]
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -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
|
||||
|
||||
6
2d/physics_tests/utils/max_steps_per_frame.gd
Normal file
6
2d/physics_tests/utils/max_steps_per_frame.gd
Normal file
@@ -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)
|
||||
1
2d/physics_tests/utils/max_steps_per_frame.gd.uid
Normal file
1
2d/physics_tests/utils/max_steps_per_frame.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://cvoeuonqmsye1
|
||||
5
2d/physics_tests/utils/physics_interpolation.gd
Normal file
5
2d/physics_tests/utils/physics_interpolation.gd
Normal file
@@ -0,0 +1,5 @@
|
||||
extends CheckButton
|
||||
|
||||
|
||||
func _on_check_button_toggled(toggled_on: bool) -> void:
|
||||
get_tree().physics_interpolation = toggled_on
|
||||
1
2d/physics_tests/utils/physics_interpolation.gd.uid
Normal file
1
2d/physics_tests/utils/physics_interpolation.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://ijebwwx4t8et
|
||||
@@ -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
|
||||
|
||||
6
2d/physics_tests/utils/ticks_per_second.gd
Normal file
6
2d/physics_tests/utils/ticks_per_second.gd
Normal file
@@ -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)
|
||||
1
2d/physics_tests/utils/ticks_per_second.gd.uid
Normal file
1
2d/physics_tests/utils/ticks_per_second.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://7kql0xtuc7ny
|
||||
8
2d/physics_tests/utils/time_scale.gd
Normal file
8
2d/physics_tests/utils/time_scale.gd
Normal file
@@ -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
|
||||
1
2d/physics_tests/utils/time_scale.gd.uid
Normal file
1
2d/physics_tests/utils/time_scale.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://beqnv31yip0bl
|
||||
Reference in New Issue
Block a user