Physic simulator view

Topics: Developer Forum
Feb 26, 2009 at 3:15 PM
Hi I need to be able to control the portion of my world to display in the physic simulator view.

For now, it displays only a portion around zero....

How can I modify that?

Thanks
Feb 28, 2009 at 9:50 AM
I did this not so long ago, you need to pass in a translation vector to draw only the part of the world where you are at the moment.

For example if your game character is at location (2000,1000) in your game. And that he is at the center of the screen with a resolution of 1280*720 the corner where you want to start drawing is at
2000-(1280/2) = 1360, 1000-(720/2) = 640. So you need to subtract the vector (1360, 640) from your object position to temporary move it into the screen area when drawing. This goes for all your objects in the world.

So what I did was to pass in this vector to the simulator view and then in every draw function in that class I subtract this position before drawing all the different contacts, bounding boxes etc..

Hope it helps