Al Capique
13-04-2006 19:07:42
Hi guys
I started with OGRE last week and, with some difficulties, I am understanding how it work.
I´m making a small application using a windows form to test some features.
Everything works perfectly.
My next step was to create a plane. So, after building the application, it crashes when I finalize it. I don´t know why and only happens when i create a plane.
My other problem is that my PT_ORTHOGRAPHIC type Camera don´t "see" my plane when it has:
Camera.Position.x == plane.Position.x
Camera.Position.z == plane.Position.z
and
Camera.LookAt == plane.Position
I think it could be a rotation problem.
Any Idea to help me?
Thanks in advance.
DigitalCyborg
14-04-2006 03:59:42
My other problem is that my PT_ORTHOGRAPHIC type Camera don´t "see" my plane when it has:
Camera.Position.x == plane.Position.x
Camera.Position.z == plane.Position.z
and
Camera.LookAt == plane.Position
well, off hand I'd try two things:
1st try changing the '==' to '='
== is the comparison operator for equality..
2nd, try moving the camera's initial position a little..
Camera.x = plane.Position.z + 100;
happy coding!
EagleEye
14-04-2006 10:05:49
the LookAt function takes a vector3 as an argument...
So camera.LookAt(SomeVector3) rather than camera.LookAt = SomeVector3...
rastaman
14-04-2006 16:15:07
I think he's just telling you what the values equal with the "==".
@Al Capique
What is the plane's Normal? are you trying to look at it "Edge On"?
I've never used a orthographic camera, but you may not be able to see a plane "Edge on" with Ogre, you may need to fake it with a Line3D.
I think you would take the crossproduct of the plane
vecCross = crossproduct of plane.Pos and (plane.Pos + (plane.Normal * 2))
then draw a (plain.Pos + (vecCross *10)) to (plane.Pos +(vecCross *-10)
Al Capique
17-04-2006 18:12:48
Sorry about the confusion in my post.
what I wanted to say was:
My other problem is that my PT_ORTHOGRAPHIC type Camera don´t "see" my plane when it has:
Camera.Position.x EQUAL plane.Position.x
Camera.Position.z EQUAL plane.Position.z
and
Camera.LookAt EQUAL plane.Position
@rastaman
No, i don´t trying to lok at it "Edge On"?
For exemple:
My plane is origin with normal (0,1,0)
My camera has position.y equal 2500
when the camera has position.x or position.z different of zero I can see the plane. But when it is on (0, 2500, 0) the plane disappears.
Al Capique
17-04-2006 20:20:45
Here is my code.
If I uncomment the 6ª line (//this._Camera.SetPosition(0, 2500, 0)) I won´t see the plane anymore.
this._Camera = _SceneManager.CreateCamera("MainCamera");
this._Camera.NearClipDistance = 1000;
this._Camera.SetPosition(0.1f, 2500, 0);
//this._Camera.SetPosition(0, 2500, 0);
this._Camera.LookAt = new Vector3(0, 0, 0);
this._Camera.ProjectionType = ProjectionType.PT_ORTHOGRAPHIC;
this._Viewport = this._RenderWindow.AddViewport(this._Camera);
this._Viewport.BackgroundColor = Color.Black;
this._Camera.AspectRatio = (float)_Viewport.ActualWidth/(float)_Viewport.ActualHeight;
Plane p = new Plane();
p.Normal.y = 1;
p.D = 0;
MeshManager.Instance.CreatePlane("plano",
"General", p, 500, 500, 1, 1, true, 1, 1, 1, Vector3.UnitZ);
Entity pEnt = this._SceneManager.CreateEntity("plano_ent", "plano");
SceneNode node = this._SceneManager.GetRootSceneNode().CreateChildSceneNode("plano_node", new Vector3(0, 0, 0));
node.AttachObject(pEnt);
ResourceGroupManager.Instance.addResourceLocation("../Resource", "FileSystem", "General");
ResourcePtr RsPtr = MaterialManager.Instance.Create("plano_mat", "General", true);
Material mat = (new MaterialPtr(RsPtr)).Get();
Technique tec = mat.GetTechnique(0);
Pass pass = tec.getPass(0);
pass.setLightingEnabled(true);
pass.setSceneBlending(SceneBlendType.SBT_ADD);
pass.setDepthWriteEnabled(false);
pass.createTextureUnitState("kiq.jpg");
mat.Load();
pEnt.SetMaterialName(mat.GetName());
this.bRender = true;
this._Root.StartRendering();
Al Capique
17-04-2006 22:16:47
Me again =Þ
I solved the problems.
For the Camera I had to call Camera.SetFixedYawAxis(false)
and with the form problem I forgot to call Application.DoEvents in FrameEnded event.
Everthing is ok now.
Thaks for for the help guys.