File tree Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -349,10 +349,11 @@ export class Physic {
349349 /**
350350 * @description Update the physic world.
351351 *
352- * @param {number | undefined } delta
352+ * @param {number | undefined } timestep The timestep length, in seconds.
353353 */
354- step ( delta = undefined ) {
355- this . world . step ( delta ) ;
354+ step ( timestep = undefined ) {
355+ if ( typeof timestep === "number" ) this . world . timestep = timestep ;
356+ this . world . step ( ) ;
356357
357358 for ( let i = 0 , l = this . dynamicObjects . length ; i < l ; i ++ ) {
358359 const object = this . dynamicObjects [ i ] ;
Original file line number Diff line number Diff line change 173173
174174 }
175175
176- function animate ( ) {
176+ const clock = new THREE . Clock ( ) ;
177177
178- physics . step ( ) ;
178+ function animate ( ) {
179+
180+ physics . step ( clock . getDelta ( ) ) ;
179181
180182 controls . update ( ) ;
181183
You can’t perform that action at this time.
0 commit comments