child of camera don't move...

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
robertgarand
Posts: 69
Joined: Fri Feb 22, 2008 6:47 pm
Location: montreal
Contact:

child of camera don't move...

Post by robertgarand »

Hi all Irrlichtians,
first of, a happy new year to all.
I am using a camera_parent ( to move a ship) wich is not the active one nor receiver enable, I move and rotate it myself using quaternion, it works fine because when I make it active after a tranformation I see it has moved. But the child (ship) don't rotate.
the ship is a animatedscenenode.

The thing is I want the view from another camera. I guess I have to force the updating of the camera_parent, I tried updateabsoluteposition(), on camera_parent and its child also, I tried cam->setRotation(cam->getTarget() - cam->getAbsolutePosition());with and without gethorizontalangle, none work.

Anyone having a clue would be very welcome.

TIA,
regards, Robert

PS: I am using a camera to get over the fact that objects are always rotated in x-y-z order, which cancel the absolute x rotation in my app...
the cam hrotation handling should get me over this.
If it can't be writen, it can't exist
cobra
Posts: 371
Joined: Fri Jan 23, 2009 2:56 am
Location: United States
Contact:

Post by cobra »

Well, try something like this:

Code: Select all

void updateShip(ICameraSceneNode *camera, IAnimatedMeshSceneNode* node)
{
         node->setPosition(camera->getPosition() + vector3df(0,-4,15));
         node->setRotation(camera->getRotation());
}
In your main loop do this:

updateShip(camera, shipNode);

Simple, but I think this may fix your problem, if you haven't already tried it.


Good luck!
Josiah Hartzell
Image
Post Reply