View Single Post
  #6 (permalink)  
Old 09-17-2007, 02:30 PM
HelloWorld's Avatar
HelloWorld HelloWorld is offline
PT Admin
Awards Showcase
Quality Tutorial 
Total Awards: 1
Join Date: Jun 2007
Location: In front of computer...
Posts: 1,118
iTrader: (0)
HelloWorld is a jewel in the roughHelloWorld is a jewel in the roughHelloWorld is a jewel in the rough
I found the solution for this one

Quote:
Oh, I see your problem.

Your ships are in 3D coordinates, which are completely different from the screen coordinates. So your Max/Min X/Z values should be computed in spatial coordinates. These values, after you find them will be resolution independent.

They are tied to the camera view and projection matrices. The distance from the XZ, and the field of view both determine how much of that plane you can see, and what are the bounds that you're looking for. If the distance is larger, or the field of view is greater, more area will be visible. If the distace is lower, or the field of view is narrower, less area will be visible. But since your distance is fixed (8000) and fov is also fixed (45), once you find appropriate values (begin with +-500 for both axis, and slowly increase until you reach a value you are satisfied with), you can hardcode them.

I don't know how to better explain this more clearly...
PHP Code:
public void CheckBoundaryCollision()
        {
            
int MaxX 500;
            
int MinX = -500;

            
int MaxZ 500;
            
int MinZ = -500;

            if (
shipPosition.MaxX)
            {
                
shipPosition.MaxX;
            }
            else if (
shipPosition.MinX)
            {
                
shipPosition.MinX;
            }
            
            if (
shipPosition.MaxZ)
            {
                
shipPosition.MaxZ;
            }
            else if (
shipPosition.MinZ)
            {
                
shipPosition.MinZ;
            }
        } 
Quote:
Then run the game, and see how the ships behave. After that, modify the MaxX, MinX, MaxZ and MinZ values slightly (add / subtract 100), run again, and repeat this process until the boundaries are ok.

You don't have to do anything with Viewport.Width and Viewport.Height. The coordinates in space have no relation to these values.
Thanx for XBOX Live ID CatalinZima for the answer

__________________
PHP Code:
System.out.println("Hello World!"); 

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
Reply With Quote