diff options
| author | Patrick Schönberger | 2021-01-22 16:57:38 +0100 |
|---|---|---|
| committer | Patrick Schönberger | 2021-01-22 16:57:38 +0100 |
| commit | 79bcaf1ac3d8bc90b697c444ff5dfb694acb6962 (patch) | |
| tree | afbf9e9b3bdfd802775eacf873b1d5a493f64292 /Scripts/cloth.js | |
| parent | 590349d576668595128e2d15bbd72e9391a97fc1 (diff) | |
| download | cloth_sim-79bcaf1ac3d8bc90b697c444ff5dfb694acb6962.tar.gz cloth_sim-79bcaf1ac3d8bc90b697c444ff5dfb694acb6962.zip | |
fix spring force calculation
Diffstat (limited to 'Scripts/cloth.js')
| -rw-r--r-- | Scripts/cloth.js | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Scripts/cloth.js b/Scripts/cloth.js index 266af16..e39b95b 100644 --- a/Scripts/cloth.js +++ b/Scripts/cloth.js @@ -112,6 +112,9 @@ export class Cloth { let vertices = [];
let faces = [];
+ this.numPointsWidth = numPointsWidth;
+ this.numPointsHeight = numPointsHeight;
+
/**
* distance between two vertices horizontally/vertically
* divide by the number of points minus one
@@ -403,8 +406,8 @@ getAcceleration(vertexIndex, dt) { // Get the bounding springs and add them to the needed springs
// TODO: optimize
- const numPointsX = 10;
- const numPointsY = 10;
+ const numPointsX = this.numPointsWidth;
+ const numPointsY = this.numPointsHeight;
const numFacesX = numPointsX - 1;
const numFacesY = numPointsY - 1;
|
