Files
godot-demo-projects/2d/physics_tests/tests/functional/test_one_way_collision.tscn
Hugo Locurcio a531235db3 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.
2025-04-21 21:59:31 +02:00

199 lines
5.8 KiB
Plaintext

[gd_scene load_steps=9 format=3 uid="uid://c85275leeliuq"]
[ext_resource type="Script" uid="uid://ybstkpm1nj3i" path="res://tests/functional/test_one_way_collision.gd" id="1"]
[ext_resource type="Texture2D" uid="uid://brwp8bimc75uu" path="res://icon.webp" id="2"]
[ext_resource type="PackedScene" uid="uid://blh3twy74kbkv" path="res://tests/test_options.tscn" id="3"]
[ext_resource type="Script" uid="uid://de1e0s7nie4wc" path="res://utils/label_slider_value.gd" id="4"]
[ext_resource type="Script" uid="uid://bbj7imitin8ud" path="res://utils/slider.gd" id="5"]
[sub_resource type="CircleShape2D" id="CircleShape2D_e5nt1"]
radius = 16.0
[sub_resource type="RectangleShape2D" id="2"]
size = Vector2(128, 64)
[sub_resource type="RectangleShape2D" id="3"]
size = Vector2(64, 64)
[node name="Test" type="Node2D"]
script = ExtResource("1")
[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="Controls" type="VBoxContainer" parent="."]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
offset_left = 25.0
offset_top = 402.0
offset_right = 425.0
offset_bottom = 500.0
grow_horizontal = 2
grow_vertical = 2
theme_override_constants/separation = 10
[node name="PlatformSize" type="HBoxContainer" parent="Controls"]
layout_mode = 2
theme_override_constants/separation = 20
alignment = 2
[node name="Label" type="Label" parent="Controls/PlatformSize"]
custom_minimum_size = Vector2(120, 2.08165e-12)
layout_mode = 2
size_flags_horizontal = 0
text = "Platform size"
[node name="HSlider" type="HSlider" parent="Controls/PlatformSize"]
custom_minimum_size = Vector2(200, 2.08165e-12)
layout_mode = 2
min_value = 64.0
max_value = 256.0
value = 64.0
script = ExtResource("5")
[node name="LabelValue" type="Label" parent="Controls/PlatformSize"]
custom_minimum_size = Vector2(60, 2.08165e-12)
layout_mode = 2
text = "64.0"
script = ExtResource("4")
[node name="PlatformAngle" type="HBoxContainer" parent="Controls"]
layout_mode = 2
theme_override_constants/separation = 20
alignment = 2
[node name="Label" type="Label" parent="Controls/PlatformAngle"]
custom_minimum_size = Vector2(120, 2.08165e-12)
layout_mode = 2
text = "Platform angle"
[node name="HSlider" type="HSlider" parent="Controls/PlatformAngle"]
custom_minimum_size = Vector2(200, 2.08165e-12)
layout_mode = 2
max_value = 360.0
script = ExtResource("5")
snap_step = 5.0
[node name="LabelValue" type="Label" parent="Controls/PlatformAngle"]
custom_minimum_size = Vector2(60, 2.08165e-12)
layout_mode = 2
text = "0.0"
script = ExtResource("4")
[node name="BodyAngle" type="HBoxContainer" parent="Controls"]
layout_mode = 2
theme_override_constants/separation = 20
alignment = 2
[node name="Label" type="Label" parent="Controls/BodyAngle"]
custom_minimum_size = Vector2(120, 2.08165e-12)
layout_mode = 2
text = "Body angle"
[node name="HSlider" type="HSlider" parent="Controls/BodyAngle"]
custom_minimum_size = Vector2(200, 2.08165e-12)
layout_mode = 2
max_value = 360.0
script = ExtResource("5")
snap_step = 5.0
[node name="LabelValue" type="Label" parent="Controls/BodyAngle"]
custom_minimum_size = Vector2(60, 2.08165e-12)
layout_mode = 2
text = "0.0"
script = ExtResource("4")
[node name="LabelResultTitle" type="Label" parent="."]
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = 34.1273
offset_top = 251.131
offset_right = 88.1273
offset_bottom = 265.131
text = "RESULT: "
[node name="LabelResult" type="Label" parent="."]
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = 34.1273
offset_top = 266.131
offset_right = 88.1273
offset_bottom = 280.131
text = "..."
[node name="LabelRestart" type="Label" parent="."]
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = 34.1273
offset_top = 304.841
offset_right = 139.127
offset_bottom = 318.841
text = "SPACE - RESTART"
[node name="Timer" type="Timer" parent="."]
wait_time = 5.0
one_shot = true
[node name="TargetArea2D" type="Area2D" parent="."]
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)
[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)
collision_mask = 2147483649
gravity_scale = 0.0
contact_monitor = true
[node name="Sprite" type="Sprite2D" parent="RigidBody2D"]
self_modulate = Color(1, 1, 1, 0.501961)
scale = Vector2(0.5, 0.5)
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)
collision_mask = 2147483649
[node name="Sprite" type="Sprite2D" parent="CharacterBody2D"]
self_modulate = Color(1, 1, 1, 0.501961)
scale = Vector2(0.5, 0.5)
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"]
[connection signal="value_changed" from="Controls/BodyAngle/HSlider" to="." method="_update_rigidbody_angle"]