cloth-physics

command module
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 3, 2023 License: MIT Imports: 25 Imported by: 0

README

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 details of how it was implemented, there is a detailed article I wrote here: 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.

Debugging:
$ cloth-physics -h

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

Supported key bindings:

  • SPACE - Reset the cloth to the default values
  • RIGHT CLICK - Make a hole in the cloth structure
  • SCROLL - Increase/decrease the mouse focus area
  • CTRL+CLICK - Pin up a cloth stick
  • 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.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL