This project has moved and is read-only. For the latest updates, please go here.

Physics out of sync with character

Topics: Developer Forum, User Forum
Mar 5, 2011 at 2:55 AM
Edited Mar 5, 2011 at 12:48 PM


I'm making a 2,5D game with side scroller camera with XNA Windows Phone 7.

All the graphics are 3D Models, and the physics should be 2D.

The main character has a physics circle and the problem is that my charachter is out of sync.

I use a virtual thumpstick to move my character. The thumpstick applies force to my physics circle.

And then i try to link the position of my 3D character to my physics circle. But they are totally out of sync.

I already tried ConvertUnits but It's totally messed up. Anyone has an idea what the best solution is?

small piece of code:


velocity += new Vector3(VirtualThumbsticks.Thumbstick * acceleration,0);
//gets the velocity from the thumpstick

playerFixture.Body.ApplyForce((new Vector2(ConvertUnits.ToSimUnits(velocity.X), ConvertUnits.ToSimUnits(- velocity.Y))));
ModelPos = newVector3(ConvertUnits.ToDisplayUnits(playerFixture.Body.Position), 0);


I tried alot of different values to add but the physics model goes to fast, and I can't get it correctly.

Any ideas? Tyvm



Mar 6, 2011 at 11:59 AM

Anyone ? Please