Original Post
Hello,
For the (open source) 2D game I'm working on, I wish to add some 3D backgrounds with perspective!
You can see this effect here:
My game being a 2D shoot'em up, I already have pixel perfect (2D) collision detection. So I'm planning to have the corridor ground drawn in 2D (useful for collision detection) but the background will be a 3D object (3 textured quads).
So far, I've successfully implemented orho2D and 3D perspective switch in my render method but now I wish to make these 2 elements (2D corridor ground and 3D background) move at the same speed and here comes my problem...
Do you have any idea of the maths involved behind this? I guess, it's all about projection setup and efficient speed ratio between 2D and 3D world?
After working on it during 2 days, I wonder if the simplest way wouldn't be to implement everything in 3D and to enhance my collision detection to work with 3D objects by clipping z-coordinates (display object surfaces only where z is 0). If so, what are the opengl commands to perform that?
Thanks for your comments! I really need some light here :)
Regards,
WS
[Edited by - wondersonic2 on June 15, 2010 3:34:15 AM]
For the (open source) 2D game I'm working on, I wish to add some 3D backgrounds with perspective!
You can see this effect here:
at the 3rd minute and 17th second: a 3D corridor with perspective.
My game being a 2D shoot'em up, I already have pixel perfect (2D) collision detection. So I'm planning to have the corridor ground drawn in 2D (useful for collision detection) but the background will be a 3D object (3 textured quads).
So far, I've successfully implemented orho2D and 3D perspective switch in my render method but now I wish to make these 2 elements (2D corridor ground and 3D background) move at the same speed and here comes my problem...
Do you have any idea of the maths involved behind this? I guess, it's all about projection setup and efficient speed ratio between 2D and 3D world?
After working on it during 2 days, I wonder if the simplest way wouldn't be to implement everything in 3D and to enhance my collision detection to work with 3D objects by clipping z-coordinates (display object surfaces only where z is 0). If so, what are the opengl commands to perform that?
Thanks for your comments! I really need some light here :)
Regards,
WS
[Edited by - wondersonic2 on June 15, 2010 3:34:15 AM]