[Problem] Tilted camera at BSP maps


14-11-2006 15:54:29

As the title says. I already researched and found that the coordinate sys of quake doesn't match ogre (or d3d). So when i load a BSP map in ogre, it would display the map's walls as the floor.

Supposedly, these line of code would fix this (found at the bottom part of http://grotsnik.ogre3d.org/wiki/index.p ... GtkRadiant , just translated for pyogre)
self.camera.setFixedYawAxis(True, ogre.Vector3.UNIT_Z)

This should work perfectly, but the weird thing is, the camera is tilted a bit.

I browsed through the cpp codes of the ogre sdk demos and translated a part of the BSP.cpp:
#ViewPoint vp = mSceneMgr->getSuggestedViewpoint(true);
vp = self.sceneManager.getSuggestedViewpoint(True)
self.camera.position = vp.position
#mCamera->pitch(Degree(90)); // Quake uses X/Y horizon, Z up
# Don't yaw along variable axis, causes leaning
#mCamera->setFixedYawAxis(true, Vector3::UNIT_Z);

similar to the previous code, this results in a tilted camera/world also.

as for now, i've just brute-forcibly adjusted the camera with this to fix the problem:

i'd like to know if there're any others using pyogre who've encountered the same problem?... and for the guru's, do you know any proper way to solve this?

thanks in advanced! :)


21-11-2006 17:38:55

Don't really use BSP, but I think this is just your camera settings, try using "camera.lookAt". Here's the code for the example you mentioned above.

# This code is in the public domain
from pyogre import ogre
import SampleFramework as sf

class BSPApplication(sf.Application):
def _chooseSceneManager(self):
self.sceneManager = self.root.createSceneManager("BspSceneManager")

def _createScene(self):
sceneManager = self.sceneManager
camera = self.camera
sceneManager.AmbientLight = (0.5, 0.5, 0.5)


# modify camera for close work
camera.nearClipDistance = 10
camera.farClipDistance = 20000

# Get random player start point
vp = self.sceneManager.getSuggestedViewpoint(True)

camera.position = vp.position
camera.pitch(ogre.Degree(90).valueRadians()) # // Quake uses X/Y horizon, Z up
# Don't yaw along variable axis, causes leaning
camera.setFixedYawAxis(True, ogre.Vector3.UNIT_Z)
# Look at the boxes

def _createFrameListener(self):
self.frameListener = BSPListener(self.renderWindow, self.camera, self.sceneManager)

class BSPListener(sf.FrameListener):
def __init__(self, renderWindow, camera, sceneManager):
sf.FrameListener.__init__(self, renderWindow, camera)
self.sceneManager = sceneManager

def frameStarted(self, frameEvent):
return sf.FrameListener.frameStarted(self, frameEvent)

if __name__ == '__main__':
application = BSPApplication()
except ogre.OgreException, e:
print e