Archived

This topic is now archived and is closed to further replies.

steg

Define size of world space...

Recommended Posts

Hi, How do you define the size of world space for your game ? If I have an object that as an xpos=20,ypos=30,zpos=100 and another object say of xpos=700, ypos=450, zpos=10 how do you know which one is in view space - I know this is down to the view transformation matrix, but again I still am trying to get my head around how you define the size of your world ? If I was to place a camera as such : D3DXMATRIX matView; D3DXMatrixLookAtLH( &matView, &D3DXVECTOR3( 0.0f, 10.0f,-5.0f ), &D3DXVECTOR3( 0.0f, 0.0f, 0.0f ), &D3DXVECTOR3( 0.0f, 1.0f, 0.0f ) ); which object would I see, if any ? I guess it''s the first one and if so, how would I then move the camera in such a way as to see the second object ? I guess I''m asking two questions now! 1. How do you define size of world space 2. How do you move the camera around to walk through the world Hope someone can help me out with this, all the example code I see is code that sets the world matrix to an identity matrix. Thanks, sTeVe

Share this post


Link to post
Share on other sites
The world space is pretty much what you define it as. You''ll probably only want to view a small portion of it at a time so that you don''t bog down your video card. You can change the parameters of how much of the world is visible (depth-wise) with something like:
D3DXMATRIX matProj;
D3DXMatrixPerspectiveFovLH(&matProj,D3DX_PI/4,1.0f,1.0f, 100.0f);


To move the camera around the world, you change the coordinates of the following:
D3DXMATRIX matView;
D3DXMatrixLookAtLH(&matView,&D3DXVECTOR3(0.0f,10.0f,-5.0f),
&D3DXVECTOR3(0.0f, 0.0f, 0.0f),
&D3DXVECTOR3(0.0f, 1.0f, 0.0f));


Share this post


Link to post
Share on other sites