File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -549,8 +549,8 @@ var Axes = require('../geometry/Axes');
549549 var timeScale = body . deltaTime / Body . timeUnit ;
550550 body . positionPrev . x = body . position . x - velocity . x * timeScale ;
551551 body . positionPrev . y = body . position . y - velocity . y * timeScale ;
552- body . velocity . x = velocity . x * timeScale ;
553- body . velocity . y = velocity . y * timeScale ;
552+ body . velocity . x = ( body . position . x - body . positionPrev . x ) / timeScale ;
553+ body . velocity . y = ( body . position . y - body . positionPrev . y ) / timeScale ;
554554 body . speed = Vector . magnitude ( body . velocity ) ;
555555 } ;
556556
@@ -599,7 +599,7 @@ var Axes = require('../geometry/Axes');
599599 Body . setAngularVelocity = function ( body , velocity ) {
600600 var timeScale = body . deltaTime / Body . timeUnit ;
601601 body . anglePrev = body . angle - velocity * timeScale ;
602- body . angularVelocity = velocity * timeScale ;
602+ body . angularVelocity = ( body . angle - body . anglePrev ) / timeScale ;
603603 body . angularSpeed = Math . abs ( body . angularVelocity ) ;
604604 } ;
605605
You can’t perform that action at this time.
0 commit comments