NxOgre object to Ogre MovableObject

Coiote

12-05-2008 12:03:58

Hey


I have a spaceshuttle class which is a NxOgre object, a body that I create.
I'm trying to attach him into my scene, but I can't do it, it allways pop this error:

Ogre::SceneNode::attachObject' : cannot convert parameter from 'SpaceShuttle *' to 'Ogre::MovableObject *

I'm trying to do this, because I want to have a camera following the object.
And I'm trying do that with these lines:

node->attachObject(SpaceShuttle); <<<--- ERROR LINE

mCamera->setAutoTracking(true,node);
camNode = mSceneMgr->getRootSceneNode()->createChildSceneNode();
camNode->attachObject(mCamera);


Thankx

betajaen

12-05-2008 12:29:38

No you can't just attached objects like that to the MovableObject feature of Ogre. Infact your attaching in the wrong direction. You should attach your Space Shuttle to the actor and not the other way around.

I assume your using 0.9, because of the lack of [Bleeding] in your topic title. So getNode() from Body will give you the actors node. Make your shuttle be a child to that.

Coiote

12-05-2008 12:36:19

Thankx betajaen for your quicky answer...once again :D

So what you're saying is for I create a method in my SpaceShuttle class that gives me the Node of that Body and then in my GameManagerClass (it's where I render all the things) call this method, right ?

Thankx

betajaen

12-05-2008 14:04:13

Yeah. If your really adventurous, you share the same node with the body and shuttle.