|
| 1 | +[gd_scene load_steps=7 format=3 uid="uid://cioc6wtbs3ubf"] |
| 2 | + |
| 3 | +[ext_resource type="Script" uid="uid://b2shq2gjd4fvt" path="res://addons/ropesim/Rope.gd" id="1_mk4gc"] |
| 4 | +[ext_resource type="Script" uid="uid://y8nntt6dh711" path="res://rope_examples/scripts/character_body_2d.gd" id="1_ww34l"] |
| 5 | +[ext_resource type="Script" uid="uid://dvxegqp0cf77n" path="res://addons/ropesim/RopeInteraction.gd" id="2_ww34l"] |
| 6 | +[ext_resource type="Texture2D" uid="uid://criwv6nuivcxy" path="res://rope_examples/icon.svg" id="3_ovf25"] |
| 7 | + |
| 8 | +[sub_resource type="PhysicsMaterial" id="PhysicsMaterial_nwm6u"] |
| 9 | + |
| 10 | +[sub_resource type="RectangleShape2D" id="RectangleShape2D_3g7xa"] |
| 11 | +size = Vector2(64, 64) |
| 12 | + |
| 13 | +[node name="rope_with_body" type="Node2D"] |
| 14 | +position = Vector2(479, 16) |
| 15 | + |
| 16 | +[node name="left_rope_mover" type="CharacterBody2D" parent="."] |
| 17 | +position = Vector2(-176, 62) |
| 18 | +motion_mode = 1 |
| 19 | +script = ExtResource("1_ww34l") |
| 20 | + |
| 21 | +[node name="Rope" type="Node2D" parent="left_rope_mover"] |
| 22 | +script = ExtResource("1_mk4gc") |
| 23 | +num_segments = 15 |
| 24 | +rope_length = 250.0 |
| 25 | +gravity = 61.765 |
| 26 | +num_constraint_iterations = 20 |
| 27 | + |
| 28 | +[node name="RopeInteraction" type="Node" parent="left_rope_mover/Rope" node_paths=PackedStringArray("target_node", "input_node_override", "rope")] |
| 29 | +script = ExtResource("2_ww34l") |
| 30 | +disable_in_editor = true |
| 31 | +position_update_mode = 0 |
| 32 | +target_node = NodePath("../../../hanging_rigidbody/attach_marker/rope_end") |
| 33 | +input_node_override = NodePath("../../../hanging_rigidbody/attach_marker") |
| 34 | +rope = NodePath("..") |
| 35 | + |
| 36 | +[node name="Label" type="Label" parent="left_rope_mover"] |
| 37 | +offset_left = -24.0 |
| 38 | +offset_top = -34.0 |
| 39 | +offset_right = 23.0 |
| 40 | +offset_bottom = -11.0 |
| 41 | +text = "WSAD" |
| 42 | + |
| 43 | +[node name="right_rope_mover" type="CharacterBody2D" parent="."] |
| 44 | +position = Vector2(185, 80) |
| 45 | +motion_mode = 1 |
| 46 | +script = ExtResource("1_ww34l") |
| 47 | +use_arrow_keys = true |
| 48 | + |
| 49 | +[node name="Rope2" type="Node2D" parent="right_rope_mover"] |
| 50 | +script = ExtResource("1_mk4gc") |
| 51 | +num_segments = 15 |
| 52 | +rope_length = 250.0 |
| 53 | +gravity = 61.765 |
| 54 | +num_constraint_iterations = 20 |
| 55 | + |
| 56 | +[node name="RopeInteraction" type="Node" parent="right_rope_mover/Rope2" node_paths=PackedStringArray("target_node", "input_node_override", "rope")] |
| 57 | +script = ExtResource("2_ww34l") |
| 58 | +disable_in_editor = true |
| 59 | +position_update_mode = 0 |
| 60 | +target_node = NodePath("../../../hanging_rigidbody/attach_marker2/rope_end2") |
| 61 | +input_node_override = NodePath("../../../hanging_rigidbody/attach_marker2") |
| 62 | +rope = NodePath("..") |
| 63 | + |
| 64 | +[node name="Label" type="Label" parent="right_rope_mover"] |
| 65 | +offset_left = -24.0 |
| 66 | +offset_top = -34.0 |
| 67 | +offset_right = 23.0 |
| 68 | +offset_bottom = -11.0 |
| 69 | +text = "Arrow keys" |
| 70 | + |
| 71 | +[node name="hanging_rigidbody" type="RigidBody2D" parent="."] |
| 72 | +position = Vector2(-75, 156) |
| 73 | +mass = 20.091 |
| 74 | +physics_material_override = SubResource("PhysicsMaterial_nwm6u") |
| 75 | +metadata/_edit_group_ = true |
| 76 | + |
| 77 | +[node name="attach_marker" type="Marker2D" parent="hanging_rigidbody"] |
| 78 | +position = Vector2(-19, 0) |
| 79 | +metadata/_edit_group_ = true |
| 80 | + |
| 81 | +[node name="rope_end" type="CharacterBody2D" parent="hanging_rigidbody/attach_marker"] |
| 82 | +collision_layer = 0 |
| 83 | +collision_mask = 0 |
| 84 | +motion_mode = 1 |
| 85 | + |
| 86 | +[node name="PinJoint2D" type="PinJoint2D" parent="hanging_rigidbody/attach_marker/rope_end"] |
| 87 | +node_a = NodePath("../../..") |
| 88 | +node_b = NodePath("..") |
| 89 | +softness = 0.05 |
| 90 | + |
| 91 | +[node name="attach_marker2" type="Marker2D" parent="hanging_rigidbody"] |
| 92 | +position = Vector2(22, 0) |
| 93 | +metadata/_edit_group_ = true |
| 94 | + |
| 95 | +[node name="rope_end2" type="CharacterBody2D" parent="hanging_rigidbody/attach_marker2"] |
| 96 | +collision_layer = 0 |
| 97 | +collision_mask = 0 |
| 98 | +motion_mode = 1 |
| 99 | + |
| 100 | +[node name="PinJoint2D2" type="PinJoint2D" parent="hanging_rigidbody/attach_marker2/rope_end2"] |
| 101 | +node_a = NodePath("../../..") |
| 102 | +node_b = NodePath("..") |
| 103 | +softness = 0.05 |
| 104 | + |
| 105 | +[node name="CollisionShape2D" type="CollisionShape2D" parent="hanging_rigidbody"] |
| 106 | +shape = SubResource("RectangleShape2D_3g7xa") |
| 107 | + |
| 108 | +[node name="Icon" type="Sprite2D" parent="hanging_rigidbody"] |
| 109 | +scale = Vector2(0.5, 0.5) |
| 110 | +texture = ExtResource("3_ovf25") |
| 111 | + |
| 112 | +[node name="Label" type="Label" parent="."] |
| 113 | +offset_left = -467.0 |
| 114 | +offset_top = 466.0 |
| 115 | +offset_right = 709.0 |
| 116 | +offset_bottom = 619.0 |
| 117 | +text = "Very similar setup to the \"rigidbody_rope_attachment\" example but with two ropes attached simultaneously. |
| 118 | +The same principles apply as before. |
| 119 | +
|
| 120 | +As before, attaching Rigidbodies to ropes is a hack and will be tricky to make look right. |
| 121 | +For example, visible gaps will appear if both ropes are pulled away too far from each other. |
| 122 | +Additionally, ropes are not processed simultaneously. One rope will always be updated earlier, which can cause execution order related effects." |
0 commit comments