How to work out the xyz coords of 2d screen?

Blitz3D Forums/Blitz3D Programming/How to work out the xyz coords of 2d screen?

Boiled Sweets(Posted 2007) [#1]
I'm sure this has been covered before but cannot find an example any where.

Imagine a 3d space invaders game. I need to stop the player from moving off screen left and right I cannot use the 2d co-ords as this is 3d space. So what is the easiest way to determine where the screen 'edges' / limits are?


big10p(Posted 2007) [#2]
Well, you can use CameraProject to get screen coords from 3D coords. However, if you use it with an entity's position, then it'll still be able to move partly off-screen, I guess.

Personally, I wouldn't bother with any of this. I'd just have a fixed cam and tweak how far the invaders can move left/right until it looks right. :)


D4NM4N(Posted 2007) [#3]
i agree, just get the invaders to go between 0 & 100(depending on your scale) then worry about getting the camera right after.
A cam position of prehaps 50,50,-200 be a good start and mve it closer 2wards 0 to get everything into play.


_PJ_(Posted 2007) [#4]
I was toying around with a simple r-type like game but using the 3D graphics. THis meant having a camera that scrolled along regularly, and a boundary on the ship XY and Z that needed to keep it from dissappearing off-screen.

I used a similar technique to Big10p's suggestion. Providing the camera isnt going to move relative to the player ship and play area, then this seems the most efficient and straigtforward option.


Moraldi(Posted 2007) [#5]
I suppose that EntityInView can help you.
When an asteroid is no visible to the camera any more then do what ever you want.
You could change also the CameraViewPort (you can make it smaller) to prevent the asteroid hide from the screen.