A question about rotating a scene node

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
TaviO!
Posts: 12
Joined: Sun Sep 20, 2009 6:53 pm

A question about rotating a scene node

Post by TaviO! »

I've created an AnimatedMeshSceneNode, using the sydney md2 from the tutorials. By running some tests, I found that the model has an initial rotation that makes it look in the direction of the X axis.

What I want to do is position the camera so that it looks like it is inside the model's head. The first step was to make it so the initial look at for the camera points in the same direction the model is facing initially.

However, I am feeling a little uneasy about this initial rotation. Who sets this initial rotation for the model? The engine? The model itself? How can I change it, if possible?

Thanks!
Abraxas)
Posts: 227
Joined: Sun Oct 18, 2009 7:24 am

Post by Abraxas) »

The answer to this is in the first tutorial
TaviO!
Posts: 12
Joined: Sun Sep 20, 2009 6:53 pm

Post by TaviO! »

I am sorry, but I read the first tutorial again (HelloWorld) and I could not find any references to what the initial rotation of the model is and wheter that depends on the md2 file or the engine.
Abraxas)
Posts: 227
Joined: Sun Oct 18, 2009 7:24 am

Post by Abraxas) »

In the future, look at the public member functions of classes.

once your node is defined as a scene node, it has ->setRotation().

remember to use the proper argument format.
TaviO!
Posts: 12
Joined: Sun Sep 20, 2009 6:53 pm

Post by TaviO! »

Using that method gives me no guarantee of where the model will be looking at after the rotation. To know that, I must know where the model is looking at initially. And that's what I'm asking: where do I find this information?
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

You just load the model and check where it looks at. This simply depends on the model, nothing else. You can use a 3d editong tool to change the rotation before laoding into Irrlicht (or the meshconverter tool, which is part of the SDK).
TaviO!
Posts: 12
Joined: Sun Sep 20, 2009 6:53 pm

Post by TaviO! »

Ok, I will try that!

Thanks for the answer!
Psan
Posts: 16
Joined: Sun Oct 04, 2009 7:07 pm

Post by Psan »

Or you can use mesh manipulator to set the initial rotation, which is as good as rotating it in a 3D editor program.

Code: Select all

   core::matrix4 m;
   m.setRotationDegrees(core::vector3df(90,0,0));  //or anything
   smgr->getMeshManipulator()->transform(mesh, m);
   scene::ISceneNode *node = smgr->addMeshSceneNode(mesh);
Edited by hybrid for proper usage of transform instead of transformMesh :-)
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

The transformMesh method is deprecated - we all know that when we pass an IMesh to a method it will work on the mesh, and when passing a buffer it will work on that buffer. That's why the method was renamed in 1.5
Post Reply