chandlerprall / Physijs

Physics plugin for Three.js
MIT License
2.75k stars 455 forks source link

onSimulationResume #242

Closed ultim8me closed 8 years ago

ultim8me commented 8 years ago

does it work for real? i do everything right i think i stop scene.simulation() in rendering with boolean and resuming it calling together scene.onsimulationresume()

first i have global variable isPaused = false; second im stopping simulation with my keydown event case 32: if(!isPaused) { isPaused = true; } else { isPaused = false; scene.onSimulationResume(); } break;

and my rendering

function animate() { requestAnimationFrame(animate); if (!isPaused) { scene.simulate(); document.getElementById("footer").innerHTML= "Running.."; } else { document.getElementById("footer").innerHTML= "Stopped.."; } renderer.render(scene, camera); loop(); }

and physics of my nonstatic object stops but when i resume i can see the object was moving while it was stopped

sohale commented 8 years ago

What is done in the loop()?

ultim8me commented 8 years ago

its working