// START -- MOVE CAMERA var p = new b2Vec2(); p = (ball.body.GetWorldCenter().x) * physics.scale; pos.push(p); var length = pos.length; var s = (pos[length - 1] - pos[length - 2]); //in pixels if ((halfwidth < (dw - p)) && (p > halfwidth)) { ctx.translate(-s, 0); } I followed this tutorial, but the ball rendering is acting weird and slow.
I can't figure out how this example did it. He used 3 variables (stage,x, y) that are undefined in the code he wrote. Also check out how the camera moves with the player in this ImpactJS demo. I'd like to have that.
How can I do this?
impact.jsexample andemanueleferonatou see when the player move the camera move with it so smoothly but in my code u see the weird slow behavior (at some point the whole scene start shaking ) \$\endgroup\$