Skip to content

Commit 0391a9b

Browse files
committed
Update examples
1 parent cefbc96 commit 0391a9b

2 files changed

Lines changed: 172 additions & 13 deletions

File tree

demo/rope_examples/line_renderer.tscn

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[gd_scene load_steps=9 format=3 uid="uid://g4jonp46a2qd"]
1+
[gd_scene load_steps=10 format=3 uid="uid://g4jonp46a2qd"]
22

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

71+
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_xi23p"]
72+
bg_color = Color(1, 1, 1, 1)
73+
border_color = Color(1, 1, 1, 1)
74+
expand_margin_left = 2.0
75+
expand_margin_right = 2.0
76+
7177
[node name="main" type="Node2D"]
7278

7379
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
@@ -198,7 +204,7 @@ position = Vector2(1057, 225)
198204
show_behind_parent = true
199205
texture_repeat = 2
200206
position = Vector2(-133, -132)
201-
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)
207+
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)
202208
texture = ExtResource("3_dh00w")
203209
texture_mode = 1
204210
script = ExtResource("5_rievp")
@@ -209,7 +215,7 @@ position_mode = 0
209215
show_behind_parent = true
210216
texture_repeat = 2
211217
position = Vector2(307, 1)
212-
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)
218+
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)
213219
texture = ExtResource("3_dh00w")
214220
texture_mode = 1
215221
script = ExtResource("5_rievp")
@@ -220,7 +226,7 @@ position_mode = 0
220226
show_behind_parent = true
221227
texture_repeat = 2
222228
position = Vector2(252, 5)
223-
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)
229+
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)
224230
texture = ExtResource("3_dh00w")
225231
texture_mode = 1
226232
script = ExtResource("5_rievp")
@@ -231,7 +237,7 @@ position_mode = 0
231237
show_behind_parent = true
232238
texture_repeat = 2
233239
position = Vector2(201, 12)
234-
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)
240+
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)
235241
texture = ExtResource("3_dh00w")
236242
texture_mode = 1
237243
script = ExtResource("5_rievp")
@@ -242,7 +248,7 @@ position_mode = 0
242248
show_behind_parent = true
243249
texture_repeat = 2
244250
position = Vector2(140, 19)
245-
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)
251+
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)
246252
texture = ExtResource("3_dh00w")
247253
texture_mode = 1
248254
script = ExtResource("5_rievp")
@@ -263,7 +269,7 @@ metadata/_edit_group_ = true
263269
show_behind_parent = true
264270
texture_repeat = 2
265271
position = Vector2(25, 8)
266-
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)
272+
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)
267273
texture = ExtResource("3_dh00w")
268274
texture_mode = 1
269275
script = ExtResource("5_rievp")
@@ -280,7 +286,7 @@ metadata/_edit_group_ = true
280286
show_behind_parent = true
281287
texture_repeat = 2
282288
position = Vector2(228, 71)
283-
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)
289+
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)
284290
texture = ExtResource("3_dh00w")
285291
texture_mode = 1
286292
script = ExtResource("5_rievp")
@@ -299,7 +305,7 @@ metadata/_edit_group_ = true
299305
show_behind_parent = true
300306
texture_repeat = 2
301307
position = Vector2(288.021, 8)
302-
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)
308+
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)
303309
texture = ExtResource("3_dh00w")
304310
texture_mode = 1
305311
script = ExtResource("5_rievp")
@@ -328,7 +334,7 @@ metadata/_edit_group_ = true
328334
show_behind_parent = true
329335
texture_repeat = 2
330336
position = Vector2(25, 8)
331-
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)
337+
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)
332338
texture = ExtResource("3_dh00w")
333339
texture_mode = 1
334340
script = ExtResource("5_rievp")
@@ -338,9 +344,23 @@ target_rope_path = NodePath("../../Rope4")
338344
show_behind_parent = true
339345
texture_repeat = 2
340346
position = Vector2(203, 0)
341-
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)
347+
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)
342348
texture = ExtResource("3_dh00w")
343349
texture_mode = 1
344350
script = ExtResource("5_rievp")
345351
position_mode = 0
346352
invert = true
353+
354+
[node name="VSeparator2" type="VSeparator" parent="."]
355+
offset_left = 582.0
356+
offset_top = -60.0
357+
offset_right = 786.0
358+
offset_bottom = 857.0
359+
theme_override_styles/separator = SubResource("StyleBoxFlat_xi23p")
360+
361+
[node name="VSeparator3" type="VSeparator" parent="."]
362+
offset_left = 1591.0
363+
offset_top = -25.0
364+
offset_right = 1795.0
365+
offset_bottom = 892.0
366+
theme_override_styles/separator = SubResource("StyleBoxFlat_xi23p")

demo/rope_examples/rope_properties.tscn

Lines changed: 141 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[gd_scene load_steps=8 format=3 uid="uid://clyutgr2fativ"]
1+
[gd_scene load_steps=10 format=3 uid="uid://clyutgr2fativ"]
22

33
[ext_resource type="Script" path="res://rope_examples/scripts/animation_player.gd" id="1_mv383"]
44
[ext_resource type="Script" path="res://addons/ropesim/RopeHandle.gd" id="3_mb3ny"]
@@ -33,6 +33,16 @@ _data = {
3333
_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]
3434
point_count = 3
3535

36+
[sub_resource type="StyleBoxLine" id="StyleBoxLine_uwde6"]
37+
color = Color(1, 1, 1, 1)
38+
thickness = 4
39+
40+
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_f4u3w"]
41+
bg_color = Color(1, 1, 1, 1)
42+
border_color = Color(1, 1, 1, 1)
43+
expand_margin_left = 2.0
44+
expand_margin_right = 2.0
45+
3646
[node name="main" type="Node2D"]
3747

3848
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
@@ -129,7 +139,7 @@ rope_path = NodePath("..")
129139
strength = 1.0
130140

131141
[node name="Node2D2" type="Node2D" parent="."]
132-
position = Vector2(148.074, 144.936)
142+
position = Vector2(180.7, 124.476)
133143

134144
[node name="Rope3" type="Node2D" parent="Node2D2"]
135145
position = Vector2(-88.3748, -22.2188)
@@ -393,3 +403,132 @@ offset_right = 1298.0
393403
offset_bottom = 540.0
394404
text = "Damping 3.0
395405
"
406+
407+
[node name="Label19" type="Label" parent="."]
408+
offset_left = 1267.0
409+
offset_top = 905.0
410+
offset_right = 1366.0
411+
offset_bottom = 928.0
412+
text = "max_endpoint_distance provides an easy way to constraint the rope length when using handles.
413+
"
414+
415+
[node name="Label22" type="Label" parent="."]
416+
offset_left = 1267.0
417+
offset_top = 1328.0
418+
offset_right = 2007.0
419+
offset_bottom = 1351.0
420+
text = "max_endpoint_distance only considers the distance between both endpoints.
421+
Does not consider the actual rope length.
422+
"
423+
424+
[node name="Label20" type="Label" parent="."]
425+
offset_left = 1236.0
426+
offset_top = 956.0
427+
offset_right = 1460.0
428+
offset_bottom = 979.0
429+
text = "max_endpoint_distance = -1"
430+
431+
[node name="Label21" type="Label" parent="."]
432+
offset_left = 1609.0
433+
offset_top = 956.0
434+
offset_right = 1837.0
435+
offset_bottom = 979.0
436+
text = "max_endpoint_distance = 100"
437+
438+
[node name="HSeparator" type="HSeparator" parent="."]
439+
offset_left = 24.0
440+
offset_top = 417.0
441+
offset_right = 1697.0
442+
offset_bottom = 421.0
443+
theme_override_styles/separator = SubResource("StyleBoxLine_uwde6")
444+
445+
[node name="HSeparator2" type="HSeparator" parent="."]
446+
offset_left = 2.0
447+
offset_top = 848.0
448+
offset_right = 1675.0
449+
offset_bottom = 852.0
450+
theme_override_styles/separator = SubResource("StyleBoxLine_uwde6")
451+
452+
[node name="VSeparator" type="VSeparator" parent="."]
453+
offset_left = 648.0
454+
offset_top = -77.0
455+
offset_right = 852.0
456+
offset_bottom = 848.0
457+
theme_override_styles/separator = SubResource("StyleBoxFlat_f4u3w")
458+
459+
[node name="VSeparator2" type="VSeparator" parent="."]
460+
offset_left = 1105.0
461+
offset_top = 854.0
462+
offset_right = 1309.0
463+
offset_bottom = 1771.0
464+
theme_override_styles/separator = SubResource("StyleBoxFlat_f4u3w")
465+
466+
[node name="Rope" type="Node2D" parent="."]
467+
position = Vector2(1317, 996)
468+
script = ExtResource("4_rnvio")
469+
470+
[node name="RopeHandle" type="Marker2D" parent="Rope"]
471+
position = Vector2(136, 257)
472+
script = ExtResource("3_mb3ny")
473+
rope_path = NodePath("..")
474+
strength = 1.0
475+
476+
[node name="Rope2" type="Node2D" parent="."]
477+
position = Vector2(1697, 992)
478+
script = ExtResource("4_rnvio")
479+
max_endpoint_distance = 100.0
480+
481+
[node name="RopeHandle" type="Marker2D" parent="Rope2"]
482+
position = Vector2(136, 257)
483+
script = ExtResource("3_mb3ny")
484+
rope_path = NodePath("..")
485+
strength = 1.0
486+
487+
[node name="Label23" type="Label" parent="."]
488+
offset_left = 1236.0
489+
offset_top = 1406.0
490+
offset_right = 1460.0
491+
offset_bottom = 1429.0
492+
text = "max_endpoint_distance = -1"
493+
494+
[node name="Label24" type="Label" parent="."]
495+
offset_left = 1609.0
496+
offset_top = 1406.0
497+
offset_right = 1837.0
498+
offset_bottom = 1429.0
499+
text = "max_endpoint_distance = 100"
500+
501+
[node name="Rope4" type="Node2D" parent="."]
502+
position = Vector2(1697, 1442)
503+
script = ExtResource("4_rnvio")
504+
max_endpoint_distance = 100.0
505+
506+
[node name="RopeHandle" type="Marker2D" parent="Rope4"]
507+
position = Vector2(250, 56)
508+
script = ExtResource("3_mb3ny")
509+
rope_path = NodePath("..")
510+
rope_position = 0.622
511+
strength = 1.0
512+
513+
[node name="RopeHandle2" type="Marker2D" parent="Rope4"]
514+
position = Vector2(139, 249)
515+
script = ExtResource("3_mb3ny")
516+
rope_path = NodePath("..")
517+
strength = 1.0
518+
519+
[node name="Rope5" type="Node2D" parent="."]
520+
position = Vector2(1318, 1446)
521+
script = ExtResource("4_rnvio")
522+
523+
[node name="RopeHandle" type="Marker2D" parent="Rope5"]
524+
position = Vector2(250, 56)
525+
script = ExtResource("3_mb3ny")
526+
rope_path = NodePath("..")
527+
rope_position = 0.622
528+
strength = 1.0
529+
530+
[node name="RopeHandle2" type="Marker2D" parent="Rope5"]
531+
position = Vector2(139, 249)
532+
script = ExtResource("3_mb3ny")
533+
rope_path = NodePath("..")
534+
strength = 1.0

0 commit comments

Comments
 (0)