Is 'Zoom' possible?

Aug 26, 2008 at 7:24 PM
I swear I saw a post on this a while ago but I can't seem to find it.  Sorry if this is a duplicate.

Is it possible to have a "zoom" feature while using Farseer objects? 

For example: Let's pretend it's a side-scrolling game that zooms in and out while the character runs.  Are the Farseering bodies able to scale with the zoom?  Thanks!
Aug 26, 2008 at 7:46 PM
Edited Aug 26, 2008 at 7:48 PM
In theory, your physics calculations are independent of your zoom level. Zoom is basically implemented by your drawing code, based on the relative sizes of your underlying data (models, bodies, geoms, etc). If you are zooming in by modifying the size of your data/physics objects I would suggest you're going the wrong way.

As example, say you have the following physics objects at the normal (1x) zoom level:
  •   a square with sides of 10 units,
  •   a circle of radius 5 units
When you draw your game objects at 1x zoom, they will be of that exact size. If the zoom level increases to 3x, it's your drawing code that should handle the up-scaling for the square from 10 to 30 units. The size of the square as far as it's physics is concerned is unchanged. The same for the circle. The physics will continue to work based on the relative sizes of the object involved.

Obviously, there are issues to be dealt with when it comes to texturing at various zoom levels, and level of detail calculations, but these again should be part of your drawing code, not your physics data. Points from collisions and such need to be scaled based on zoom level as well.
Aug 27, 2008 at 8:33 PM
You should ask Walaber... The creator of Gymnast as he done it in that using the Farseer Engine and XNA
Developer
Sep 24, 2008 at 7:52 AM
Edited Sep 24, 2008 at 7:54 AM
It's actually very very simple oO. All you have to do is pass a custom Matrix into SpriteBatch.Begin.

http://www.ziggyware.com/readarticle.php?article_id=172

I'm using it to fix the size of the renderd area.
So the graphics look always the same size, no matter what resolution you use.
Coordinator
Sep 24, 2008 at 12:21 PM
@Treacles - Is Gymnast based on Farseer?

I thought that he made his own, since he did that soft body engine some time ago.
Sep 25, 2008 at 3:11 PM
Edited Sep 25, 2008 at 3:12 PM
@genbox - http://www.farseergames.com/blog/post/Walabers-Gymnastics-Game-Released-(Windows-or-XBOX360).aspx ;)
Coordinator
Sep 25, 2008 at 4:57 PM
Yeah, I feel kind of silly not reading that :)

How nice is that. I have great respect for walaber, and him making a game with Farseer is fantastic.

Thanks garus.