This guide will help you install PixelRope and set up your first rope simulation in Godot 4.4.
- Open your Godot project
- Navigate to AssetLib tab in the top center of the editor
- Search for "PixelRope"
- Click on the plugin and press "Download"
- In the installation dialog, click "Install"
- Enable the plugin in Project Settings > Plugins
- Download the plugin from the GitHub repository
- Extract the
addons/pixel_ropefolder into your project'saddonsdirectory - Enable the plugin in Project Settings > Plugins
After installation, you can add a PixelRope node to your scene through the editor:
- Right-click in the Scene panel and select "Add Child Node"
- Search for "PixelRope" and select it
- The rope will appear with default anchors that you can position
- Adjust properties in the Inspector panel
- Create a new scene or open an existing one
- Right-click in the Scene panel and select "Add Child Node"
- Search for "PixelRope" and add it to your scene
- By default, the rope comes with two anchor points: "StartAnchor" and "EndAnchor"
- Select and position these anchors in your scene
- Adjust the rope properties in the Inspector panel:
- Set
segment_countto control detail (higher values = more detailed physics) - Adjust
pixel_sizeto match your game's visual style - Choose a
rope_colorto match your theme
- Set
# Create a basic rope
func create_rope():
# Instantiate the rope
var rope = PixelRope.new()
# Configure basic properties
rope.segment_count = 50
rope.segment_length = 5.0
rope.pixel_size = 4
rope.rope_color = Color(0.8, 0.6, 0.2)
# Add to scene
add_child(rope)
# Position the anchors
rope.start_position = Vector2(100, 100)
rope.end_position = Vector2(300, 300)
return ropeTo make your rope interactive (grabbable):
# Configure rope interaction
func setup_interactive_rope(rope):
# Allow grabbing anywhere on the rope
rope.interaction_mode = PixelRope.GrabMode.ANY_POINT
rope.interaction_width = 20.0
# Connect signals for interaction events
rope.rope_grabbed.connect(_on_rope_grabbed)
rope.rope_released.connect(_on_rope_released)
func _on_rope_grabbed(segment_index):
print("Grabbed rope segment: ", segment_index)
func _on_rope_released():
print("Released rope")Configure how your rope behaves physically:
# Set up physics properties
func configure_rope_physics(rope):
# Gravity direction and strength
rope.gravity = Vector2(0, 980) # Standard downward gravity
# Damping controls how quickly the rope settles
rope.damping = 0.98 # Higher = less bouncy
# Iterations affect stability (higher = more stable but more CPU intensive)
rope.iterations = 10
# How much the rope can stretch before breaking
rope.max_stretch_factor = 2.0 # 2x normal lengthHere's a complete example that sets up a rope with all basic properties:
extends Node2D
func _ready():
# Create and configure rope
var rope = create_basic_rope()
# Connect to signals
rope.rope_broken.connect(_on_rope_broken)
func create_basic_rope() -> PixelRope:
var rope = PixelRope.new()
# Basic properties
rope.segment_count = 40
rope.segment_length = 5.0
rope.pixel_size = 4
rope.rope_color = Color(0.8, 0.6, 0.2)
# Physics properties
rope.gravity = Vector2(0, 980)
rope.damping = 0.98
rope.iterations = 10
rope.max_stretch_factor = 2.0
# Anchor properties
rope.dynamic_start_anchor = false # Fixed start point
rope.dynamic_end_anchor = true # End point affected by physics
# Interaction
rope.interaction_mode = PixelRope.GrabMode.ANY_POINT
rope.interaction_width = 20.0
# Add to scene
add_child(rope)
# Position
rope.start_position = Vector2(100, 100)
rope.end_position = Vector2(300, 300)
return rope
func _on_rope_broken():
print("Rope has broken!")
# Optionally reset the rope after a delay
await get_tree().create_timer(2.0).timeout
get_children().filter(func(c): return c is PixelRope)[0].reset_rope()Now that you have a basic rope set up, you might want to:
- Explore advanced configuration options
- Add collisions with the environment
- Create dynamic bridges or grappling hooks
- Learn about performance optimization
For a complete reference of all available properties and methods, see the API Reference.