Game Development Community

Can I change the camera to an isometric perspective?

by John Klimek · in Torque Game Engine · 01/21/2009 (3:38 pm) · 3 replies

Can I easily change the camera in TGE to an isometric perspective? (eg. like Neverwinter Nights, etc)

If so, how?

Thanks for any help!

#1
01/21/2009 (3:56 pm)
it's a bit of a hassle but you can do it.
i was able to hack it together by defining a global variable gOrthoScale,
and then changing dglSetFrustum to this:
F32 gOrthoScale = 1.0f;

void dglSetFrustum(F64 left, F64 right, F64 bottom, F64 top, F64 nearPlane, F64 farPlane, bool ortho)
{
	
   // this converts from a coord system looking down the pos-y axis
   // to ogl's down neg z axis.
   // it's stored in OGL matrix form
   static F32 darkToOGLCoord[16] = { 1, 0,  0, 0,
                                     0, 0, -1, 0,
                                     0, 1,  0, 0,
                                     0, 0,  0, 1 };

   frustLeft   = left      * gOrthoScale;
   frustRight  = right     * gOrthoScale;
   frustBottom = bottom    * gOrthoScale;
   frustTop    = top       * gOrthoScale;
   frustNear   = nearPlane;
   frustFar    = farPlane;
   isOrtho     = dglIsOrtho();
   if (ortho)
   {
      glOrtho(left, right, bottom, top, nearPlane, farPlane);
      worldToScreenScale = viewPort.extent.x / (frustRight - frustLeft);
   }
   else
   {
      glFrustum(left, right, bottom, top, nearPlane, farPlane);
      worldToScreenScale = (frustNear * viewPort.extent.x) / (frustRight - frustLeft);
   }
   glMultMatrixf(darkToOGLCoord);
}
and exposing the variable to script,
but it's very, very hacky and definitely not ready as a user-facing feature.

#2
01/21/2009 (4:31 pm)
Thanks for the reply. I was hoping it might be a bit easier than hacking in the source code but I really appriciate your help very much!
#3
07/03/2009 (4:17 am)
noob question, where change these code?