Skip to content

Commit

Permalink
Update examples
Browse files Browse the repository at this point in the history
  • Loading branch information
mphe committed Jul 23, 2024
1 parent cefbc96 commit 0391a9b
Show file tree
Hide file tree
Showing 2 changed files with 172 additions and 13 deletions.
42 changes: 31 additions & 11 deletions demo/rope_examples/line_renderer.tscn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[gd_scene load_steps=9 format=3 uid="uid://g4jonp46a2qd"]
[gd_scene load_steps=10 format=3 uid="uid://g4jonp46a2qd"]

[ext_resource type="Script" path="res://addons/ropesim/RopeHandle.gd" id="1_1x8kc"]
[ext_resource type="Script" path="res://rope_examples/scripts/animation_player.gd" id="1_ip83o"]
Expand Down Expand Up @@ -68,6 +68,12 @@ _data = {
"moving": SubResource("Animation_sw2bi")
}

[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_xi23p"]
bg_color = Color(1, 1, 1, 1)
border_color = Color(1, 1, 1, 1)
expand_margin_left = 2.0
expand_margin_right = 2.0

[node name="main" type="Node2D"]

[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
Expand Down Expand Up @@ -198,7 +204,7 @@ position = Vector2(1057, 225)
show_behind_parent = true
texture_repeat = 2
position = Vector2(-133, -132)
points = PackedVector2Array(0, 0, -2.83585, 12.5661, -5.66405, 25.0578, -8.48508, 37.4467, -11.2998, 49.711, -14.1088, 61.835, -16.9124, 73.8076, -19.7104, 85.6215, -22.5021, 97.2723, -25.2868, 108.757, -28.0632, 120.075, -30.8302, 131.225, -33.5863, 142.208, -36.3299, 153.022, -39.0593, 163.67, -41.773, 174.15, -44.4692, 184.465, -47.146, 194.613, -49.8017, 204.596, -52.4346, 214.415, -55.0426, 224.069)
points = PackedVector2Array(0, 0, -0.722794, 12.932, -1.23862, 25.7996, -1.49449, 38.5739, -1.52303, 51.2288, -1.39105, 63.7453, -1.16194, 76.1113, -0.880508, 88.3193, -0.5728, 100.365, -0.251495, 112.244, 0.0788269, 123.955, 0.417938, 135.498, 0.767776, 146.87, 1.13104, 158.071, 1.51077, 169.1, 1.91002, 179.956, 2.33171, 190.639, 2.77904, 201.149, 3.25516, 211.484, 3.76396, 221.644, 4.30963, 231.629)
texture = ExtResource("3_dh00w")
texture_mode = 1
script = ExtResource("5_rievp")
Expand All @@ -209,7 +215,7 @@ position_mode = 0
show_behind_parent = true
texture_repeat = 2
position = Vector2(307, 1)
points = PackedVector2Array(0, 0, -2.83585, 12.5661, -5.66405, 25.0578, -8.48508, 37.4467, -11.2998, 49.711, -14.1088, 61.835, -16.9124, 73.8076, -19.7104, 85.6215, -22.5021, 97.2723, -25.2868, 108.757, -28.0632, 120.075, -30.8302, 131.225, -33.5863, 142.208, -36.3299, 153.022, -39.0593, 163.67, -41.773, 174.15, -44.4692, 184.465, -47.146, 194.613, -49.8017, 204.596, -52.4346, 214.415, -55.0426, 224.069)
points = PackedVector2Array(0, 0, -0.722794, 12.932, -1.23862, 25.7996, -1.49449, 38.5739, -1.52303, 51.2288, -1.39105, 63.7453, -1.16194, 76.1113, -0.880508, 88.3193, -0.5728, 100.365, -0.251495, 112.244, 0.0788269, 123.955, 0.417938, 135.498, 0.767776, 146.87, 1.13104, 158.071, 1.51077, 169.1, 1.91002, 179.956, 2.33171, 190.639, 2.77904, 201.149, 3.25516, 211.484, 3.76396, 221.644, 4.30963, 231.629)
texture = ExtResource("3_dh00w")
texture_mode = 1
script = ExtResource("5_rievp")
Expand All @@ -220,7 +226,7 @@ position_mode = 0
show_behind_parent = true
texture_repeat = 2
position = Vector2(252, 5)
points = PackedVector2Array(0, 0, -2.83585, 12.5661, -5.66405, 25.0578, -8.48508, 37.4467, -11.2998, 49.711, -14.1088, 61.835, -16.9124, 73.8076, -19.7104, 85.6215, -22.5021, 97.2723, -25.2868, 108.757, -28.0632, 120.075, -30.8302, 131.225, -33.5863, 142.208, -36.3299, 153.022, -39.0593, 163.67, -41.773, 174.15, -44.4692, 184.465, -47.146, 194.613, -49.8017, 204.596, -52.4346, 214.415, -55.0426, 224.069)
points = PackedVector2Array(0, 0, -0.722794, 12.932, -1.23862, 25.7996, -1.49449, 38.5739, -1.52303, 51.2288, -1.39105, 63.7453, -1.16194, 76.1113, -0.880508, 88.3193, -0.5728, 100.365, -0.251495, 112.244, 0.0788269, 123.955, 0.417938, 135.498, 0.767776, 146.87, 1.13104, 158.071, 1.51077, 169.1, 1.91002, 179.956, 2.33171, 190.639, 2.77904, 201.149, 3.25516, 211.484, 3.76396, 221.644, 4.30963, 231.629)
texture = ExtResource("3_dh00w")
texture_mode = 1
script = ExtResource("5_rievp")
Expand All @@ -231,7 +237,7 @@ position_mode = 0
show_behind_parent = true
texture_repeat = 2
position = Vector2(201, 12)
points = PackedVector2Array(0, 0, -2.83585, 12.5661, -5.66405, 25.0578, -8.48508, 37.4467, -11.2998, 49.711, -14.1088, 61.835, -16.9124, 73.8076, -19.7104, 85.6215, -22.5021, 97.2723, -25.2868, 108.757, -28.0632, 120.075, -30.8302, 131.225, -33.5863, 142.208, -36.3299, 153.022, -39.0593, 163.67, -41.773, 174.15, -44.4692, 184.465, -47.146, 194.613, -49.8017, 204.596, -52.4346, 214.415, -55.0426, 224.069)
points = PackedVector2Array(0, 0, -0.722794, 12.932, -1.23862, 25.7996, -1.49449, 38.5739, -1.52303, 51.2288, -1.39105, 63.7453, -1.16194, 76.1113, -0.880508, 88.3193, -0.5728, 100.365, -0.251495, 112.244, 0.0788269, 123.955, 0.417938, 135.498, 0.767776, 146.87, 1.13104, 158.071, 1.51077, 169.1, 1.91002, 179.956, 2.33171, 190.639, 2.77904, 201.149, 3.25516, 211.484, 3.76396, 221.644, 4.30963, 231.629)
texture = ExtResource("3_dh00w")
texture_mode = 1
script = ExtResource("5_rievp")
Expand All @@ -242,7 +248,7 @@ position_mode = 0
show_behind_parent = true
texture_repeat = 2
position = Vector2(140, 19)
points = PackedVector2Array(0, 0, -2.83585, 12.5661, -5.66405, 25.0578, -8.48508, 37.4467, -11.2998, 49.711, -14.1088, 61.835, -16.9124, 73.8076, -19.7104, 85.6215, -22.5021, 97.2723, -25.2868, 108.757, -28.0632, 120.075, -30.8302, 131.225, -33.5863, 142.208, -36.3299, 153.022, -39.0593, 163.67, -41.773, 174.15, -44.4692, 184.465, -47.146, 194.613, -49.8017, 204.596, -52.4346, 214.415, -55.0426, 224.069)
points = PackedVector2Array(0, 0, -0.722794, 12.932, -1.23862, 25.7996, -1.49449, 38.5739, -1.52303, 51.2288, -1.39105, 63.7453, -1.16194, 76.1113, -0.880508, 88.3193, -0.5728, 100.365, -0.251495, 112.244, 0.0788269, 123.955, 0.417938, 135.498, 0.767776, 146.87, 1.13104, 158.071, 1.51077, 169.1, 1.91002, 179.956, 2.33171, 190.639, 2.77904, 201.149, 3.25516, 211.484, 3.76396, 221.644, 4.30963, 231.629)
texture = ExtResource("3_dh00w")
texture_mode = 1
script = ExtResource("5_rievp")
Expand All @@ -263,7 +269,7 @@ metadata/_edit_group_ = true
show_behind_parent = true
texture_repeat = 2
position = Vector2(25, 8)
points = PackedVector2Array(-25.6525, -8, -28.4884, 4.5661, -31.3166, 17.0578, -34.1376, 29.4467, -36.9523, 41.711, -39.7613, 53.835, -42.5649, 65.8076, -45.3629, 77.6215, -48.1546, 89.2723, -50.9393, 100.757, -53.7157, 112.075, -56.4827, 123.225, -59.2388, 134.208, -61.9824, 145.022, -64.7118, 155.67, -67.4255, 166.15, -70.1217, 176.465, -72.7985, 186.613, -75.4542, 196.596, -78.0871, 206.415, -80.6951, 216.069)
points = PackedVector2Array(-18.1114, -8, -18.8342, 4.93199, -19.35, 17.7996, -19.6059, 30.5739, -19.6344, 43.2288, -19.5024, 55.7453, -19.2733, 68.1113, -18.9919, 80.3193, -18.6842, 92.3645, -18.3629, 104.244, -18.0325, 115.955, -17.6934, 127.498, -17.3436, 138.87, -16.9803, 150.071, -16.6006, 161.1, -16.2014, 171.956, -15.7797, 182.639, -15.3323, 193.149, -14.8562, 203.484, -14.3474, 213.644, -13.8017, 223.629)
texture = ExtResource("3_dh00w")
texture_mode = 1
script = ExtResource("5_rievp")
Expand All @@ -280,7 +286,7 @@ metadata/_edit_group_ = true
show_behind_parent = true
texture_repeat = 2
position = Vector2(228, 71)
points = PackedVector2Array(-228, -71, -228, -58.1105, -228, -45.2946, -228, -32.5795, -228, -19.9864, -228, -7.53052, -228, 4.77734, -228, 16.93, -228, 28.9226, -228, 40.7524, -227.999, 52.4175, -227.999, 63.917, -227.999, 75.2502, -227.999, 86.417, -227.999, 97.4172, -227.998, 108.251, -227.998, 118.917, -227.998, 129.417, -227.998, 139.751, -227.997, 149.918, -227.997, 159.918)
points = PackedVector2Array(-228, -71, -228, -58.1105, -228, -45.2946, -228, -32.5795, -228, -19.9864, -228, -7.53052, -228, 4.77734, -228, 16.93, -228, 28.9226, -228, 40.7524, -228, 52.4175, -228, 63.917, -228, 75.2502, -228, 86.4171, -228, 97.4172, -228, 108.251, -228, 118.917, -228, 129.418, -228, 139.751, -228, 149.918, -228, 159.918)
texture = ExtResource("3_dh00w")
texture_mode = 1
script = ExtResource("5_rievp")
Expand All @@ -299,7 +305,7 @@ metadata/_edit_group_ = true
show_behind_parent = true
texture_repeat = 2
position = Vector2(288.021, 8)
points = PackedVector2Array(-288.021, -8, -285.644, 2.92297, -283.11, 13.7374, -280.312, 24.3867, -277.157, 34.8157, -273.534, 44.9559, -269.274, 54.7012, -264.121, 63.8546, -257.677, 71.9982, -249.436, 78.1768, -239.419, 80.5198, -229.444, 77.6694, -221.27, 71.0529, -214.872, 62.5068, -209.75, 52.9601, -205.514, 42.8307, -201.914, 32.3325, -198.789, 21.5969, -196.029, 10.7188, -193.536, -0.223572, -191.433, -10)
points = PackedVector2Array(-288.021, -8, -285.644, 2.92297, -283.11, 13.7374, -280.312, 24.3867, -277.158, 34.8157, -273.534, 44.956, -269.274, 54.7013, -264.121, 63.8546, -257.677, 71.9983, -249.436, 78.1768, -239.419, 80.5198, -229.445, 77.6694, -221.27, 71.0529, -214.873, 62.5068, -209.75, 52.9601, -205.514, 42.8307, -201.914, 32.3325, -198.789, 21.5969, -196.029, 10.7188, -193.536, -0.223572, -191.433, -10)
texture = ExtResource("3_dh00w")
texture_mode = 1
script = ExtResource("5_rievp")
Expand Down Expand Up @@ -328,7 +334,7 @@ metadata/_edit_group_ = true
show_behind_parent = true
texture_repeat = 2
position = Vector2(25, 8)
points = PackedVector2Array(-25, -8, -25, 1.94431, -25, 11.8619, -25, 21.7462, -25, 31.5945, -25, 41.4075, -25, 51.188, -25, 60.9401, -25, 70.6684, -25, 80.3772, -25, 90.0707, -25, 99.7525, -25, 109.425, -25, 119.092, -25, 128.753, -25, 138.411, -25, 148.067, -25, 157.721, -25, 167.374, -25, 177.025, -25, 186.676)
points = PackedVector2Array(-25, -8, -25, 0.0043335, -25, 7.98198, -25, 15.9263, -25, 23.8346, -25, 31.7076, -25, 39.5482, -25, 47.3604, -25, 55.1487, -25, 62.9175, -25, 70.6711, -25, 78.4129, -25, 86.1458, -25, 93.8721, -25, 101.594, -25, 109.312, -25, 117.028, -25, 124.742, -25, 132.454, -25, 140.166, -25, 147.877)
texture = ExtResource("3_dh00w")
texture_mode = 1
script = ExtResource("5_rievp")
Expand All @@ -338,9 +344,23 @@ target_rope_path = NodePath("../../Rope4")
show_behind_parent = true
texture_repeat = 2
position = Vector2(203, 0)
points = PackedVector2Array(0, 194.676, 0, 185.025, 0, 175.374, 0, 165.721, 0, 156.067, 0, 146.411, 0, 136.753, 0, 127.092, 0, 117.425, 0, 107.752, 0, 98.0707, 0, 88.3772, 0, 78.6684, 0, 68.9401, 0, 59.188, 0, 49.4075, 0, 39.5945, 0, 29.7462, 0, 19.8619, 0, 9.94431, 0, 0)
points = PackedVector2Array(0, 155.877, 0, 148.166, 0, 140.454, 0, 132.742, 0, 125.028, 0, 117.312, 0, 109.594, 0, 101.872, 0, 94.1458, 0, 86.4129, 0, 78.6711, 0, 70.9175, 0, 63.1487, 0, 55.3604, 0, 47.5482, 0, 39.7076, 0, 31.8346, 0, 23.9263, 0, 15.982, 0, 8.00433, 0, 0)
texture = ExtResource("3_dh00w")
texture_mode = 1
script = ExtResource("5_rievp")
position_mode = 0
invert = true

[node name="VSeparator2" type="VSeparator" parent="."]
offset_left = 582.0
offset_top = -60.0
offset_right = 786.0
offset_bottom = 857.0
theme_override_styles/separator = SubResource("StyleBoxFlat_xi23p")

[node name="VSeparator3" type="VSeparator" parent="."]
offset_left = 1591.0
offset_top = -25.0
offset_right = 1795.0
offset_bottom = 892.0
theme_override_styles/separator = SubResource("StyleBoxFlat_xi23p")
143 changes: 141 additions & 2 deletions demo/rope_examples/rope_properties.tscn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[gd_scene load_steps=8 format=3 uid="uid://clyutgr2fativ"]
[gd_scene load_steps=10 format=3 uid="uid://clyutgr2fativ"]

[ext_resource type="Script" path="res://rope_examples/scripts/animation_player.gd" id="1_mv383"]
[ext_resource type="Script" path="res://addons/ropesim/RopeHandle.gd" id="3_mb3ny"]
Expand Down Expand Up @@ -33,6 +33,16 @@ _data = {
_data = [Vector2(0.134615, 1), 0.0, 0.0, 0, 0, Vector2(0.485577, 0.484536), 0.0, -0.0200405, 0, 1, Vector2(1, 0.474227), 0.231403, 0.0, 0, 0]
point_count = 3

[sub_resource type="StyleBoxLine" id="StyleBoxLine_uwde6"]
color = Color(1, 1, 1, 1)
thickness = 4

[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_f4u3w"]
bg_color = Color(1, 1, 1, 1)
border_color = Color(1, 1, 1, 1)
expand_margin_left = 2.0
expand_margin_right = 2.0

[node name="main" type="Node2D"]

[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
Expand Down Expand Up @@ -129,7 +139,7 @@ rope_path = NodePath("..")
strength = 1.0

[node name="Node2D2" type="Node2D" parent="."]
position = Vector2(148.074, 144.936)
position = Vector2(180.7, 124.476)

[node name="Rope3" type="Node2D" parent="Node2D2"]
position = Vector2(-88.3748, -22.2188)
Expand Down Expand Up @@ -393,3 +403,132 @@ offset_right = 1298.0
offset_bottom = 540.0
text = "Damping 3.0
"

[node name="Label19" type="Label" parent="."]
offset_left = 1267.0
offset_top = 905.0
offset_right = 1366.0
offset_bottom = 928.0
text = "max_endpoint_distance provides an easy way to constraint the rope length when using handles.
"

[node name="Label22" type="Label" parent="."]
offset_left = 1267.0
offset_top = 1328.0
offset_right = 2007.0
offset_bottom = 1351.0
text = "max_endpoint_distance only considers the distance between both endpoints.
Does not consider the actual rope length.
"

[node name="Label20" type="Label" parent="."]
offset_left = 1236.0
offset_top = 956.0
offset_right = 1460.0
offset_bottom = 979.0
text = "max_endpoint_distance = -1"

[node name="Label21" type="Label" parent="."]
offset_left = 1609.0
offset_top = 956.0
offset_right = 1837.0
offset_bottom = 979.0
text = "max_endpoint_distance = 100"

[node name="HSeparator" type="HSeparator" parent="."]
offset_left = 24.0
offset_top = 417.0
offset_right = 1697.0
offset_bottom = 421.0
theme_override_styles/separator = SubResource("StyleBoxLine_uwde6")

[node name="HSeparator2" type="HSeparator" parent="."]
offset_left = 2.0
offset_top = 848.0
offset_right = 1675.0
offset_bottom = 852.0
theme_override_styles/separator = SubResource("StyleBoxLine_uwde6")

[node name="VSeparator" type="VSeparator" parent="."]
offset_left = 648.0
offset_top = -77.0
offset_right = 852.0
offset_bottom = 848.0
theme_override_styles/separator = SubResource("StyleBoxFlat_f4u3w")

[node name="VSeparator2" type="VSeparator" parent="."]
offset_left = 1105.0
offset_top = 854.0
offset_right = 1309.0
offset_bottom = 1771.0
theme_override_styles/separator = SubResource("StyleBoxFlat_f4u3w")

[node name="Rope" type="Node2D" parent="."]
position = Vector2(1317, 996)
script = ExtResource("4_rnvio")

[node name="RopeHandle" type="Marker2D" parent="Rope"]
position = Vector2(136, 257)
script = ExtResource("3_mb3ny")
rope_path = NodePath("..")
strength = 1.0

[node name="Rope2" type="Node2D" parent="."]
position = Vector2(1697, 992)
script = ExtResource("4_rnvio")
max_endpoint_distance = 100.0

[node name="RopeHandle" type="Marker2D" parent="Rope2"]
position = Vector2(136, 257)
script = ExtResource("3_mb3ny")
rope_path = NodePath("..")
strength = 1.0

[node name="Label23" type="Label" parent="."]
offset_left = 1236.0
offset_top = 1406.0
offset_right = 1460.0
offset_bottom = 1429.0
text = "max_endpoint_distance = -1"

[node name="Label24" type="Label" parent="."]
offset_left = 1609.0
offset_top = 1406.0
offset_right = 1837.0
offset_bottom = 1429.0
text = "max_endpoint_distance = 100"

[node name="Rope4" type="Node2D" parent="."]
position = Vector2(1697, 1442)
script = ExtResource("4_rnvio")
max_endpoint_distance = 100.0

[node name="RopeHandle" type="Marker2D" parent="Rope4"]
position = Vector2(250, 56)
script = ExtResource("3_mb3ny")
rope_path = NodePath("..")
rope_position = 0.622
strength = 1.0

[node name="RopeHandle2" type="Marker2D" parent="Rope4"]
position = Vector2(139, 249)
script = ExtResource("3_mb3ny")
rope_path = NodePath("..")
strength = 1.0

[node name="Rope5" type="Node2D" parent="."]
position = Vector2(1318, 1446)
script = ExtResource("4_rnvio")

[node name="RopeHandle" type="Marker2D" parent="Rope5"]
position = Vector2(250, 56)
script = ExtResource("3_mb3ny")
rope_path = NodePath("..")
rope_position = 0.622
strength = 1.0

[node name="RopeHandle2" type="Marker2D" parent="Rope5"]
position = Vector2(139, 249)
script = ExtResource("3_mb3ny")
rope_path = NodePath("..")
strength = 1.0

0 comments on commit 0391a9b

Please sign in to comment.