I’m an experienced c#/WPF programmer but totally new with XNA.
I started with the beginners guides, that was easy to do and good to understand. Now I
want to go and build something by adding some stuff to the 3D tutorial game/code http://creators.xna.com/en-US/education/gettingstarted/bg3d/chapter10 .
I noticed that the viewing looks like you are watching trough a big hallway, without the walls. Because you don’t see any 3d objects running/starting at the far sides of the screen. I want to create a world that looks like Space, and not that only 3d objects (in this case ships) will appear from the center. Like the image on http://msdn.microsoft.com/en-us/library/bb975157(XNAGameStudio.30).aspx I can adjust the dept (Z) easily, but not the width and height of the “Viewing Frustum”.
So I just want to make the Space as wide and high as possible.
I test with setting the ship startpositions wider as normal:
Vector3 shipMinPosition = new Vector3(-2000.0f, 300.0f, -6000.0f);
Vector3 shipMaxPosition = new Vector3(2000.0f, 800.0f, -4000.0f);
Changed to:
Vector3 shipMinPosition = new Vector3(-9000.0f, 300.0f, -6000.0f);
Vector3 shipMaxPosition = new Vector3(9000.0f, 800.0f, -4000.0f);
Then the most ships are NOT visible on the screen.
I tried to modify the following with much different values, but without success.
cameraViewMatrix = Matrix.CreateLookAt(
cameraPosition,
cameraLookAt,
Vector3.Up);
cameraProjectionMatrix = Matrix.CreatePerspectiveFieldOfView(
MathHelper.ToRadians(45.0f),
graphics.GraphicsDevice.Viewport.AspectRatio,
1.0f,
10000.0f);
Does anybody know what to change or to look to get a wider space.
PS: it is easier to test without drawing the terrain and to center the camera:
Vector3 cameraPosition = new Vector3(0.0f, 0.0f, 160.0f);
Vector3 cameraLookAt = new Vector3(0.0f, 0.0f, 0.0f);
I Hope someone can help me.