Cube model is not a cube in-game

Lawlcat

13-11-2010 01:01:47



Please ignore textured image, I just chose a random picture on my HDD when I was doing this.

Trying to see how to import my own models and such through Blender into Ogre.

Well, this was a perfect cube in blender. IS a perfect cube in blender. However when I load it in OGRE, this is what I see. A squashed version. This happens under Direct X or openGl, windowed or not windowed, any resolution.


Any ideas why? Just using the basic tutorial framework, replaced model with my own


namespace Mogre.Tutorials
{
class Tutorial : BaseApplication
{


public static void Main()
{
new Tutorial().Go();
}

protected override void CreateScene()
{
SceneManager sceneMgr = mRoot.CreateSceneManager(SceneType.ST_GENERIC);
Camera camera = sceneMgr.CreateCamera("Camera");
camera.Position = new Vector3(0, 0, 150);
camera.LookAt(Vector3.ZERO);

Entity ent = mSceneMgr.CreateEntity("box", "Cube.mesh");
SceneNode node = mSceneMgr.RootSceneNode.CreateChildSceneNode("boxnode");
node.AttachObject(ent);
}
}
}

smiley80

13-11-2010 06:56:19

That's a bug in the tutorial framework.
In CreateViewports:
mCamera.AspectRatio = (vp.ActualWidth / vp.ActualHeight);
should be:
mCamera.AspectRatio = ((float)vp.ActualWidth / vp.ActualHeight);



SceneManager sceneMgr = mRoot.CreateSceneManager(SceneType.ST_GENERIC);
Camera camera = sceneMgr.CreateCamera("Camera");
camera.Position = new Vector3(0, 0, 150);
camera.LookAt(Vector3.ZERO);


You create a second SceneManager and Camera here.
If you want to change the default SceneManager/Camera, you have to override ChooseSceneManager/CreateCamera and set mSceneMgr/mCamera.

Lawlcat

13-11-2010 07:22:38

Alright, awesome :) Wasn't sure if it was something with my rendering, with the way the mesh exported or what.

Appreciate the help :)