This project has moved. For the latest updates, please go here.

Choppy/Laggy Sprite Animation

Topics: Developer Forum, User Forum
Oct 7, 2014 at 5:46 AM
So i am using farseer physics in this 2D platformer that i am making, but for some reason it makes the animations choppy and its irritating. I have tried it with 2 different sprites, the first had 4 frames the other had 10. The animation is only choppy when using farseer.

Here is the code where i create the body for the sprite:

Here is the code updating the position:

I do convert the _body.position to display units.

Im sorry that these are only pictures of the code but at least it's not much. I would post the actual code if i could but im using my phone and my internet is down atm. If there is anything else you need to help me just tell me and i will put it up. Thanks.
Oct 14, 2014 at 6:48 PM
Edited Oct 14, 2014 at 6:54 PM
use body.ApplyForce(new Vector2(x,y), body.Position);

for example
            if ((body.LinearVelocity.X * body.LinearVelocity.X) + (body.LinearVelocity.Y * body.LinearVelocity.Y) < _movementSpeed * _movementSpeed)
                if (Game1.input.key_left)
                    body.ApplyForce(new Vector2(-_movementSpeed, 0), body.Position);
                if (Game1.input.key_down)
                    body.ApplyForce(new Vector2(0, -_movementSpeed), body.Position);
                if (Game1.input.key_right)
                    body.ApplyForce(new Vector2(_movementSpeed, 0), body.Position);
                if (Game1.input.key_up)
                    body.ApplyForce(new Vector2(0, _movementSpeed), body.Position);
and then get the position to draw:

drawPosition.X = ConvertUnits.ToDisplayUnits(body.Position.X);
drawPosition.Y = ConvertUnits.ToDisplayUnits(body.Position.Y);