Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mattatz/unity-verlet-simulator
Simple verlet integration simulator for Unity.
https://github.com/mattatz/unity-verlet-simulator
Last synced: 1 day ago
JSON representation
Simple verlet integration simulator for Unity.
- Host: GitHub
- URL: https://github.com/mattatz/unity-verlet-simulator
- Owner: mattatz
- License: mit
- Created: 2017-09-25T10:51:39.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-03-23T01:20:12.000Z (almost 6 years ago)
- Last Synced: 2025-02-09T04:51:21.969Z (11 days ago)
- Language: C#
- Size: 46.1 MB
- Stars: 265
- Watchers: 17
- Forks: 38
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-unity-open-source-on-github - unity-verlet-simulator - Simple verlet integration simulator (Physics)
README
unity-verlet-simulator
=====================GPU-based simple verlet integration simulator for Unity.



## Usage (chain structure example)
```cs
[SerializeField] ComputeShader compute; // GPUVerletSimulator.compute
GPUVerletSimulator simulator;void Start() {
const float edgeLength = 0.5f;// define nodes and edges.
var nodes = new GPUNode[nodesCount];
for(int i = 0; i < nodesCount; i++)
{
var n = nodes[i];
var p = new Vector3(Random.value - 0.5f, i * edgeLength, Random.value - 0.5f);
n.position = n.prev = p;
n.decay = 1f;
nodes[i] = n;
}var edgesCount = nodesCount - 1;
var edges = new GPUEdge[edgesCount];
for(int i = 0; i < edgesCount; i++)
{
var e = edges[i];
e.a = i;
e.b = i + 1;
e.length = edgeLength;
edges[i] = e;
}// create simulator instance.
simulator = new GPUVerletSimulator(nodes, edges);
}void Update() {
const int iterations = 8;// simulate
simulator.Step(compute);
for(int i = 0; i < iterations; i++)
{
simulator.Solve(compute);
}
}```
## Sources
- Advanced Character Physics - http://web.archive.org/web/20080410171619/http://www.teknikus.dk/tj/gdc2001.htm
## Compatibility
tested on Unity 2018.2.4f, windows10 (GTX 1060).