Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I am programming a simple pool game in XNA. I am using Farseer for simple 2d physics but I want to use 3d graphics. My problem is I can't get the rendering to work.

I have one model for the ball and one for the table, both exported from Cinema 4D into .fbx. I am able to load them and even display them, but not on the correct position. Farseer is using standart coordinate system (X+ to the right, Y+ down) and I need to somehow convert the position from farseer and display the models on the right place on the screen and with the correct size (this should be easy to achieve using scale matrix).

I need help finding what my projection, view, and world matrices I should use?

share|improve this question
    
Farseer is just a 2D Physics-Engine. If you're trying to add physics to those models, you'll need something like BEPUPhsyics –  IMX May 6 '13 at 18:38
    
I know this, but I am making just a pool game which needs no depth, just 2D physics. However, I am using 3D models instead of just simple sprites for the graphics. –  user30395 May 6 '13 at 20:34

1 Answer 1

up vote 0 down vote accepted

You may want to consider turning on DEBUG VIEW in farseer, if you haven't already done so. I also had a difficult time lining up my Farseer objects with my 2D world objects. The following is the code I used to get the objects to line up:

Matrix proj = Matrix.CreateOrthographicOffCenter(0f, Viewport.Width, Viewport.Height, 0f, 0f, 1f);
Matrix view2 = Matrix.CreateScale(32);
view2 *= view;
_worldDebug.RenderDebugData(ref proj, ref view2);

The "view" above, is the matrix used when drawing everything else.

I suspect this may help solve your issue, it would most likely be a matter of adjusting the Scale matrix.

share|improve this answer
    
Thanks for answer, it seems like my models are displayed on the correct position. Part of the tables texture disappeared (it was there when I rendered it with perspective projection) though, but I am going to remake the models later anyway. –  user30395 May 6 '13 at 16:14

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.