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

Changing canvas size effects forces

Topics: Developer Forum
Jan 16, 2011 at 2:21 AM


I'm creating a level based platform game (think sonic)

To move the character I am applying force using the ApplyForce function.

I had the game working well and then decided to make a bigger map.

When I did this, all the forces in the game felt wrong. I.e. when I 'walked left or right' the character hardly moved, and the gravity felt different etc.

What is the best strategy for having consistant forces across different size Canvases (levels)

Thanks in advance for your help.


Jan 18, 2011 at 9:36 PM

You need a resolution (in this case: canvas size) independent scaled physics world. When you have that, you can zoom in and out all you want and the forces should stay the same.

Jan 18, 2011 at 11:10 PM

Hi genbox,

Thanks for your reply.  Could you please tell me what the main properties are that I need to configure to achieve this?



Jan 18, 2011 at 11:38 PM

Just make sure, your physics objects are always the same size and scaled to the MKS system and not somehow dependent on the world size.

For instance if you have a physics object with 1m x 1m in size, keep that size constant over different canvas sizes and just change the size of the texture you use to draw that physics object e.g. scale it to be bigger or smaler. Have a look at the HelloWorldXNA sample from source control or search for "MKS" on the discussion boards. There are already several topics that discuss scaling and things like using a camera for zooming etc... that hopefully should get you started.