Skip to content

Latest commit

 

History

History
59 lines (44 loc) · 2.9 KB

README.md

File metadata and controls

59 lines (44 loc) · 2.9 KB

cloth-physics

Build License Release

cloth-physics is a native desktop application for 2D cloth physics simulation implementing Verlet integration. It's written in Gio, a GUI framework for Go.

It has the following characteristics:

  • Possibility to tear up the cloth by applying a mouse pressure on the cloth structure. You can increase the mouse dragging force by pressing and holding the left mouse button. The mouse focus area will change its color depending on the applied force.
  • Possibility to make up a hole in the cloth structure by pressing the right mouse button.
  • You can change the mouse cloth interaction area by using the scroll button.
  • With CTRL-left click you can pin up the cloth stick under the mouse position.

Note: In case you want to learn more about the implementation details, here is a detailed article I wrote: https://medium.com/@esimov/2d-cloth-simulation-in-go-using-gio-gui-b3dfe00b7223.

How to run

Before running the application check the Gio documentation for the system requirements. Install the required dependencies then type the following commands.

$ git clone https://github.com/esimov/cloth-physics
$ go run ./...

Another way is to build the executable yourself then simply run it.

$ go build ./...
$ cloth-physics

If you don't have Go installed on your machine you can run the prebuild binary files from the project packages page. For convenience if you wish to try the application on a mobile device the .apk file is also provided in the same packages page.

Debugging:

$ cloth-physics -h

  -debug-cpuprofile string
        write CPU profile to this file
  -debug-frame
        debug the Gio frame rates

Supported key bindings:

  • F1 - Show/hide the quick help panel
  • SPACE - Redraw the cloth
  • RIGHT CLICK - Tear the cloth at the mouse position
  • SCROLL Up/Down - Increase/decrease the mouse focus area
  • CTRL+CLICK - Pin up the cloth on the mouse position
  • LEFT CLICK+HOLD - Increase the mouse pressure

Author

License

Copyright © 2023 Endre Simo

This software is distributed under the MIT license. See the LICENSE file for the full license text.