Cant rotate a mesh

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
humbrol
Posts: 83
Joined: Sun Nov 18, 2007 8:22 pm

Cant rotate a mesh

Post by humbrol »

Im using arrays cockpit flight controls to control the node and make the camera and heres the node setup info

Code: Select all

 IAnimatedMesh* mesh = smgr->getMesh("../../media/shuttle/shuttle9.3ds");
        if (!mesh)
        {
                device->drop();
                return 1;
        }
        IAnimatedMeshSceneNode* node1 = smgr->addAnimatedMeshSceneNode( mesh );
       if (node1)
        {
                node1->setMaterialFlag(EMF_LIGHTING, false);
                node1->setScale(vector3df(.005,.005,.005));
                node1->setRotation(vector3df(0,-90,0));

                       }

no matter how i change the setRotation, the model stays facing the same direction,, it moves and flies correctly, just the model isnt orientated correctly. any tips?


plus in my workings with arras flight controls it appears the camera is the object moved and the node is moved around the camera, is there a way to get the controls to control the node and the camera to follow?
Mux
Posts: 56
Joined: Mon Feb 26, 2007 12:25 pm
Location: Stockholm

Post by Mux »

Maybe you could try:

Code: Select all

node1->setRotation(vector3df(0,node1->getRotation().Y-90,0)); 
It'll only take a minute or two to debug this code...
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

It sounds like the mesh isn't aligned with the correct coordinate system. If you open the mesh up in an editor, you want Y up and Z forward. You can fix this with code, but it is much easier to just use an editor.

Travis
Post Reply