Hello,
I'm prototyping my next project which is a 3d airplane shooter. The camera is a top-down (bird's eye) perspective that simulates a 2D feel, but I'm using 3d coordinates because it seems like an obvious choice when using meshes and not sprites. Firstly, should I just convert to 2d coordinates to simplify the process while not sacrificing the use of 3d objects?
My problem is that I want to copy a 2D implementation, where anything (enemies, bullets, etc) outside of the boundaries of the current screen (determined by the device's width and height) would be made inactive/deallocated. The problem is that with my camera at a given Y-intercept (height), I am unsure about how to determine crossing the boundaries; the device's width and height are not correct measures of the viewport's bounds. I was thinking of somehow using the camera's field of view to determine the bounds, but it seemed a bit tedious and troublesome. Before diving into that implementation, I just wanted to get some feedback on alternate design choices.
Thanks!
Airplane Shooter Design Question [solved]
-
Jgoldnight
- Posts: 31
- Joined: Thu Jun 07, 2007 6:23 pm
- Location: New York
- Contact:
Airplane Shooter Design Question [solved]
Last edited by Jgoldnight on Sun May 25, 2008 11:38 pm, edited 1 time in total.
Computer scientist by day...
http://www.mrjoelkemp.com
http://www.mrjoelkemp.com
Re: Airplane Shooter Design Question
You can check the corners of the screen (or the of the area used for your display in case you don't need the whole screen) with ray = SceneCollisionManager::getRayFromScreenCoordinates. The resulting rays be collided with the plane on which your objects are. plane3d::getIntersectionWithLine can do that for you (as parameters use: ray.start, ray.start+ray.end). Then you have the corners of your visible area in units.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
-
Jgoldnight
- Posts: 31
- Joined: Thu Jun 07, 2007 6:23 pm
- Location: New York
- Contact: