Move world instead of body

Nov 17, 2008 at 7:56 AM

I am making a game where a digger should digg into the ground. But im having trouble making the world move acording to the digger. What i have now is that my digger can fly around just fine and land on the surface and digg. But when the digger comes to a specific point in the world, like 300 pixes below center screen, the world should move and not the digger, so it seems that is still going down, but instead the world is going up. 

Is it possible to take the force the body gets when being pulled down by the gravity and move the world up with the same speed as the digger would fall, without moving my digger?
Nov 17, 2008 at 4:28 PM
This should be handled entierly in your drawing code.  Rather than moving every single body up 300 pixels, draw everything 300 pixels higher than you normally would.  Just store the camera position in a Vector2, and subtract this vector from the body's position to determine where to draw the object.  It's easy to pan the camera around this way.
Feb 2, 2009 at 2:21 AM
Hi I know this is an old question but just read it and this might help someone.

I havnt got xna in front of me so doing this from memory(which is questionable)

If you are using spritebatch in xna you can pass a transformation matrix into the spritebatch.begin method.
create the transformation matrix using the MATRIX class.

This way you dont need to do any subtracting just use your camera location and rotation to build a transformation matrix and give it to the spritebatch.begin method.

If you are into effect shaders you can use the vertex shader to move the world around the screen.

Thanks for Farseer by the way, I am a hobby programmer and this is just so much fun to use.
Feb 2, 2009 at 3:58 AM
Edited Feb 3, 2009 at 5:30 AM
hmm it seems that you cant, but i'm sure that you could write an overloaded method that calls the right draw method after applyig the proper transofrmations and/or rotations to the position variable(s)...
EDIT: oops, i thought you were talking about the draw method... yup you can!