diff options
| author | Patrick Schönberger | 2021-01-18 15:10:05 +0100 |
|---|---|---|
| committer | Patrick Schönberger | 2021-01-18 15:10:05 +0100 |
| commit | a30256db1a628e1fd7f9a1537bebb9bdea8f3719 (patch) | |
| tree | 5bc743687908ac7cbbf52b2b298c458c58545bec /Scripts/main.js | |
| parent | e05a5c0a7aa891179af219eff0df34647acc8eb3 (diff) | |
| download | cloth_sim-a30256db1a628e1fd7f9a1537bebb9bdea8f3719.tar.gz cloth_sim-a30256db1a628e1fd7f9a1537bebb9bdea8f3719.zip | |
make vertices rigid, tune parameters
Diffstat (limited to 'Scripts/main.js')
| -rw-r--r-- | Scripts/main.js | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/Scripts/main.js b/Scripts/main.js index 5ed1866..ececd6a 100644 --- a/Scripts/main.js +++ b/Scripts/main.js @@ -65,13 +65,16 @@ function init() { */
const canvasSpace = 200;
+ /** Constant Frame Time */
+ const frameTime = 1000.0 / 60.0;
+
/** Setup scene */
let [scene, camera, renderer] = setup_scene(canvasSpace);
/** setup cloth and generate debug mesh */
let cloth = new Cloth();
- cloth.createBasic(10, 10, 5, 5);
- cloth.createDebugMesh(scene);
+ cloth.createBasic(10, 10, 10, 10);
+ //cloth.createDebugMesh(scene);
const material = new THREE.MeshBasicMaterial({ color: 0x0000ff });
const mesh = new THREE.Mesh(cloth.geometry, material);
@@ -87,12 +90,11 @@ function init() { * @param {number} dt - time passed since last frame
*/
function animate(dt) {
-
cloth.simulate(dt);
setTimeout(() => {
- animate(2000);
- }, 2000);
+ animate(frameTime);
+ }, frameTime);
renderer.render(scene, camera);
}
|
