Hi! I have a question about the 3D perspective in Irrlicht. I find this scheme on a website who explain the 3D perspective:
I'd like to find the angle formed by the lines leak, drawn in red on the image. Is a function in Irrlicht to get this angle or is an alternative method exist to find it?
Grab the camera you are using (ICameraSceneNode) and use getViewFrustum() to get the current view frustum (SViewFrustum). Then create 2 vectors (vector3df), v1 = (camera position - viewFrustum.getFarLeftUp()) and v2 (camera position - viewFrustum.getFarLeftDown()) and get the angle between these two vectors by doing v1.getHorizontalAngle() - v2.getHorizontalAngle(). Should serve your needs
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
BlindSide wrote:Grab the camera you are using (ICameraSceneNode) and use getViewFrustum() to get the current view frustum (SViewFrustum). Then create 2 vectors (vector3df), v1 = (camera position - viewFrustum.getFarLeftUp()) and v2 (camera position - viewFrustum.getFarLeftDown()) and get the angle between these two vectors by doing v1.getHorizontalAngle() - v2.getHorizontalAngle()
acos returns angles in radians, so divide by pi and multiply by 180 to get degrees.
Oh yes, do this instead, just remember it's important to normalize like in his example otherwise you will get unexpected results. You can also use the built in constant core::RADTODEG to switch to degrees.
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net