mirror of
https://github.com/godotengine/godot-demo-projects.git
synced 2025-12-31 09:49:06 +03:00
- 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.
168 lines
5.7 KiB
Plaintext
168 lines
5.7 KiB
Plaintext
[gd_scene load_steps=12 format=3 uid="uid://bxx2ftwccdlft"]
|
|
|
|
[ext_resource type="Script" uid="uid://bc7qj5246usj0" path="res://tests/functional/test_character_pixels.gd" id="1"]
|
|
[ext_resource type="Script" uid="uid://3kutyof2jcdh" path="res://utils/rigidbody_controller.gd" id="2"]
|
|
[ext_resource type="PackedScene" uid="uid://blh3twy74kbkv" path="res://tests/test_options.tscn" id="3"]
|
|
[ext_resource type="PackedScene" uid="uid://cx2q80okt25o1" path="res://tests/static_scene_flat.tscn" id="4"]
|
|
[ext_resource type="Script" uid="uid://gajv1ool1il5" path="res://utils/characterbody_controller.gd" id="7"]
|
|
|
|
[sub_resource type="RectangleShape2D" id="3"]
|
|
size = Vector2(6, 9.8)
|
|
|
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_scs3g"]
|
|
size = Vector2(6, 4.8)
|
|
|
|
[sub_resource type="SeparationRayShape2D" id="SeparationRayShape2D_vby12"]
|
|
length = 7.0
|
|
|
|
[sub_resource type="PhysicsMaterial" id="1"]
|
|
friction = 0.0
|
|
|
|
[sub_resource type="RectangleShape2D" id="2"]
|
|
size = Vector2(6, 10)
|
|
|
|
[sub_resource type="RectangleShape2D" id="6"]
|
|
size = Vector2(20, 4)
|
|
|
|
[node name="Test" type="Node2D"]
|
|
script = ExtResource("1")
|
|
_motion_speed = 30.0
|
|
_gravity_force = 2.0
|
|
_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
|
|
offset_bottom = 600.0
|
|
size_flags_horizontal = 3
|
|
size_flags_vertical = 3
|
|
stretch = true
|
|
|
|
[node name="Viewport" type="SubViewport" parent="ViewportContainer"]
|
|
handle_input_locally = false
|
|
size = Vector2i(1024, 600)
|
|
size_2d_override = Vector2i(128, 75)
|
|
size_2d_override_stretch = true
|
|
render_target_update_mode = 4
|
|
|
|
[node name="StaticSceneFlat" parent="ViewportContainer/Viewport" instance=ExtResource("4")]
|
|
position = Vector2(0, -450)
|
|
|
|
[node name="CharacterBody2D" type="CharacterBody2D" parent="ViewportContainer/Viewport"]
|
|
position = Vector2(30, 40)
|
|
collision_mask = 2147483649
|
|
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)
|
|
collision_mask = 2147483649
|
|
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="RigidBody2D" parent="ViewportContainer/Viewport"]
|
|
position = Vector2(30, 40)
|
|
collision_mask = 2147483649
|
|
physics_material_override = SubResource("1")
|
|
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="RigidBody2D" parent="ViewportContainer/Viewport"]
|
|
position = Vector2(30, 40)
|
|
collision_mask = 2147483649
|
|
physics_material_override = SubResource("1")
|
|
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="Wall2" type="StaticBody2D" parent="ViewportContainer/Viewport"]
|
|
position = Vector2(122, 40)
|
|
|
|
[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)
|
|
|
|
[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: "
|
|
|
|
[node name="Options" parent="." instance=ExtResource("3")]
|
|
|
|
[node name="LabelFloor" type="Label" parent="."]
|
|
offset_left = 14.0
|
|
offset_top = 237.929
|
|
offset_right = 145.0
|
|
offset_bottom = 251.929
|
|
text = "ON FLOOR"
|
|
|
|
[node name="LabelControls" type="Label" parent="."]
|
|
offset_left = 14.0
|
|
offset_top = 263.291
|
|
offset_right = 145.0
|
|
offset_bottom = 294.291
|
|
text = "LEFT/RIGHT - MOVE
|
|
UP - JUMP"
|