8WeekGame – Competition 2 – 3D Collisions – Oh My….





Right, i have a week off this week to:


1) Code lots

2) But a Windows Phone 7 HTC HD7

3) Fable 3 of course…..


The “Code Lots” statement  couldnt ring more true. Im now doing to move onto 3D Collisions. I have an asteroid and ship model loaded, and i was going to move onto spawning lots of asteroids that moved in random directions, but i thought i would do the hardest part first – 3D Collisions! Now the recently launched App Hub (AKA Creators Club), has a particular sample im interested in here. This sample displays the 3D models name when the players cursor is crossing the models BoundingSpere.


Now in 2D games, the basic theory of collisions (Per Pixel or Intersection), is that if two objects (Say a PLayer and Enemy) share the same screen space (Your preference on how much should be specified as a “Collision”) or intersects a bounding oject (usually a rectangle) – then a collision is detected and you perform your own game logic depending on what you want to do (Like a player loosing a life if it hits an Enemy). Screen space is made up of X & Y coordinates of the screen and XNA uses the Right Handed Cartesian Coordinates:




Its little different in 3D, because you are dealing with World Space, which is the area of the game that is used to determine where to render your models. And models are composed of lots of Triangles within a 3D coordinate syste, ie the Z coordinate (X,Y,Z), in terms of the depth. What the sample from the App Hub teaches you is to convert the World Space of the models to screen space (Top left of the screen to bottom right), and check a BoundingSphere intersect between two objects. This is how ive intrepreted it, but please tell me if im wrong!

SO thats what im doing today!  Good luck to me! Hopefully once this is done i can build my HUD for lives and start to actually build some game play, because at the moment ive just been experimenting with ideas.






3D coordinate system
Image via Wikipedia


Enhanced by Zemanta

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: