A 2D verlet integration based rope simulation for Godot 3.x. Written in C++ using GDNative for fast performance.
The computation-heavy simulation part is written in C++, the rest in GDscript. This allows for fast processing and easy extendability, while keeping the code readable.
- Clone or download the repository
- Run
git submodule update --init --recursive - Get the library
- Copy or symlink
demo/addonsto your project or use the provided demo project. - Enable the addon in the project settings
- Restart Godot
See here on how to compile GDNative libraries.
Output files are saved to demo/addons/ropesim/bin/.
E.g. to compile for Linux:
$ cd godot-cpp
$ scons platform=linux generate_bindings=yes -j8 bits=64 target=release
$ cd ..
$ scons platform=linux -j8 target=release "$@"You can use the provided scripts to build for Linux and Windows.
./compile_bindings.sh./compile.sh
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 anArea2Dto detect collisions with the target rope.
See inline comments for further information and documentation of node properties.
When one of these nodes is selected, a "Ropesim" menu appears in the editor toolbar that can be used to toggle live preview in the editor on and off.
All rope related tools, automatically pause themselves when their target rope is paused to save performance.
A quick overview of how to use each node.
ropesim_showcase.mp4
Jellyfish with rope simulated tentacles.