![](https://private-user-images.githubusercontent.com/7116001/280549778-272f4f65-cb79-4798-97ba-f0d43589caef.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ0MjgzNDksIm5iZiI6MTcyNDQyODA0OSwicGF0aCI6Ii83MTE2MDAxLzI4MDU0OTc3OC0yNzJmNGY2NS1jYjc5LTQ3OTgtOTdiYS1mMGQ0MzU4OWNhZWYucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDgyMyUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA4MjNUMTU0NzI5WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9YmMzMmM4Nzk3OTQ2MDVmYjI5ZGEwZjU4NDRhNDcwYjBjN2Y0YjVlNjU2NDc0ODU3YzdkZDhkZmYwNWU0ZDJhYSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.FDVim4px7e_nS5dIO40XoQxRJ7iE5F9iBVF0g-cq1NY)
A 2D verlet integration based rope simulation for Godot 4.2+.
The computation-heavy simulation part is written in C++ using GDExtension, the rest in GDScript. This allows for fast processing and easy extendability, while keeping the code readable.
The last Godot 3.x version can be found on the 3.x branch, however, this branch will no longer receive updates.
- Get the addon
- Copy or symlink
addons/ropesim
to your project'saddons/
directory - Enable the addon in the project settings
- Restart Godot
First, clone or download the repository and run git submodule update --init --recursive
.
See here on how to create and compile GDExtension libraries.
To compile for Linux, run the following commands. Compiling for other platforms works analogously.
$ scons target=template_release platform=linux optimize=speed arch=x86_64 -j8
$ scons target=template_debug platform=linux arch=x86_64 -j8
Output files are saved to demo/addons/ropesim/bin/
.
The following nodes exist:
Rope
: The basic rope node. Optionally renders the rope usingdraw_polyline()
.RopeAnchor
: Always snaps to the specified position on the target rope. Optionally, also adapts to the rope's curvature. Can be used to attach objects to a rope.RopeHandle
: A handle that can be used to control, animate, or fixate parts of the rope.RopeRendererLine2D
: Renders a target rope usingLine2D
.RopeCollisionShapeGenerator
: Can be used e.g. in anArea2D
to detect collisions with the target rope.RopeInteraction
: Handles mutual interaction of a target node with a rope. Useful for rope grabbing or pulling mechanics where an object should be able to affect the rope and vice-versa.
NOTE: All rope related tools automatically pause themselves when their target rope is paused to reduce computation costs and improve performance.
Use the in-engine help to view the full documentation for each node.
When one of the above nodes is selected, a "Ropesim" menu appears in the editor toolbar with the following options:
Preview in Editor
: Toggle live preview in the editor on or off.Reset Rope
: Reset the selected rope to its resting position.
The project includes various example scenes that demonstrate the features of this plugin. See also the showcase video for a basic usage example.
A quick overview of how to use each node.
ropesim_showcase.mp4
Jellyfish with rope simulated tentacles.
jelly.final_4M.mp4
More advanced usage examples.