/Godot-cloth-simulation

A cloth simulation made in godot game engine.

Primary LanguageGDScriptMIT LicenseMIT

ClothSimulation

Cloth simulation for Godot. Created to make realistic cloaks in my project. Sadly not very user friendly, I'm quite new and dunno how to integrate some feauters with editor. There are settuped as Script variables

screenshots

Dependencies

Godot 3.2.1

Usage

Demo

Download reposity and load it as project in godot. Open Test1.tscn(showcase) or Test2.tscs(Benchmark) under ClothSimulation dir and press f6 to run.

If it's to laggy(shouldn't be too much but tested only on my i5-7300hq, older u series processors can have problems) decrease interpolation steps of nodes useing right pane.

In project use

  1. Add cloth node
  2. Add Polygon2d to scene, and att VerletPolygon.gd script to it.
  3. In Polygon2D uv editor setup points and add Polygons, Script will automaticly setup desired Verlet simulation and update polygon points position with simulation resoults.
  4. Set up Static verticles script variable to anchor desired points.
    (check index of desired vertexes e.g in data/uv of polygon and add to parameter list)

Documentation

Code documention stored in VerletPolygon/VerletPolygon.md file.

TODO

  • Add option to interpolate only edges: smaller amunt of vertices is barery visible on places with lesser amount of details, making so will increase performace by decreasing number of vertices and connections without big quality decrease
  • Add weight to simulated vertices
  • Rewrite verlet engine as c++/C#(slower but easier to integrate with engine) module for better performace