The ProgrammersTalk Community
Forum Register Search Today's Posts Mark Forums Read
Register

Go Back   The ProgrammersTalk Community > Graphic & Game Programming > XNA Development


Welcome to the The ProgrammersTalk Community forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.
Tags: , , , , ,

Reply
 
LinkBack Thread Tools    Display Modes   
  #1 (permalink)  
Old 09-17-2007, 01:08 AM
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
Icon13 How do you Check Boundary Collision?

PHP Code:
            int MaxX ScreenManager.GraphicsDevice.Viewport.Width 50;
            
int MinX 0;

            
int MaxY ScreenManager.GraphicsDevice.Viewport.Height 50;
            
int MinY 0
For some reason, the Max, and Min Y doesn't work... But Max X, and Min X works fine, though I need to adjust the value... Please help me on this, I'm trying to detect boundary collision in the full screen game... thanx in advance

Here's the full method:

PHP Code:
        public void CheckBoundaryCollision()
        {
            
int MaxX ScreenManager.GraphicsDevice.Viewport.Width 50;
            
int MinX 0;

            
int MaxY ScreenManager.GraphicsDevice.Viewport.Height 50;
            
int MinY 0;

            if (
shipPosition.MaxX)
            {
                
shipPosition.MaxX;
            }
            else if (
shipPosition.MinX)
            {
                
shipPosition.MinX;
            }
            else if (
shipPosition.MaxY)
            {
                
shipPosition.MaxY;
            }
            else if (
shipPosition.MinY)
            {
                
shipPosition.MinY;
            }
        } 
I call this method in Update()

__________________
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
  #2 (permalink)  
Old 09-17-2007, 07:00 AM
ccoonen ccoonen is offline
PT Staff
Awards Showcase
Quality Tutorial Quality Tutorial Quality Tutorial Quality Tutorial 
Total Awards: 4
Join Date: Jun 2007
Location: Wisconsin
Posts: 317
iTrader: (0)
ccoonen is on a distinguished roadccoonen is on a distinguished roadccoonen is on a distinguished roadccoonen is on a distinguished road
I'm not familiar with XNA but sounds like I should get into it - is XNA like the .NET 3.0 Xaml thing?
Reply With Quote
  #3 (permalink)  
Old 09-17-2007, 08:29 AM
Lee's Avatar
Lee Lee is offline
PT Staff*
Awards Showcase
Quality Tutorial 
Total Awards: 1
Join Date: Jun 2007
Location: Blackpool, UK
Posts: 616
iTrader: (0)
Lee is just really niceLee is just really niceLee is just really niceLee is just really nice
I always had it down as the easier and less powerful thing too something like DirectX
Reply With Quote
  #4 (permalink)  
Old 09-17-2007, 11:41 AM
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
XNA is built upon DirectX, I think it's really powerful to just make an INDIE game, and since I don't know what are things that you can't do in XNA that you can do if you just use DirectX, well the difference probably you're more using C++ and know what craps behind everything, but XNA is a way for you to focus more with the game play and the fun of it, not the craps. Moreover, I'm now waiting for XNA 2.0 where they supports networking, etc etc... Here's the link:

XNA Team Blog : Announcing XNA Game Studio 2.0

__________________
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
  #5 (permalink)  
Old 09-17-2007, 01:41 PM
ccoonen ccoonen is offline
PT Staff
Awards Showcase
Quality Tutorial Quality Tutorial Quality Tutorial Quality Tutorial 
Total Awards: 4
Join Date: Jun 2007
Location: Wisconsin
Posts: 317
iTrader: (0)
ccoonen is on a distinguished roadccoonen is on a distinguished roadccoonen is on a distinguished roadccoonen is on a distinguished road
Great... Now I got the bug!, lol (Downloading XNA Game STudio Express 1.0 Refresh right now)...
Reply With Quote
  #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
Reply


Thread Tools
Display Modes

   Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -7. The time now is 11:28 AM. Powered by vBulletin
Copyright © 2000 - 2007, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO © 2007 ProgrammersTalk Sedo - Buy and Sell Domain Names and Websites project info: programmerstalk.net Statistics for project programmerstalk.net etracker® web controlling instead of log file analysis


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50