Camera to Character-animation

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
804
Posts: 73
Joined: Thu Nov 10, 2011 7:07 pm

Camera to Character-animation

Post by 804 »

I have a animated model of my player and i want the camera to move with its animation.
So if the modell jumps the camera moves the same way, like a childnode but moving with the animation of the character.

I don't know how to explain it, but i want something like the camera does in this video:
http://www.youtube.com/watch?v=3N27BKwC_0Y
///////////////////////////////////////////
My Forum: http://game-home.1x.de/
My Homepage: http://mediadesign.about.lc/
///////////////////////////////////////////
smso
Posts: 246
Joined: Fri Jun 04, 2010 3:28 pm
Location: Hong Kong

Re: Camera to Character-animation

Post by smso »

Guess only:
you may try parenting the camera to the head of the animated mesh scene node:

Code: Select all

scene::IAnimatedMeshSceneNode* node = ...
scene::IBoneSceneNode* head = node->getJointNode("head");
if (head)
     camera->setParent(head);
Regards from smso
804
Posts: 73
Joined: Thu Nov 10, 2011 7:07 pm

Re: Camera to Character-animation

Post by 804 »

I have to set a name for the joint while moddeling and then just call it in my code?
So in your example the name of the joint is "head" !?
///////////////////////////////////////////
My Forum: http://game-home.1x.de/
My Homepage: http://mediadesign.about.lc/
///////////////////////////////////////////
smso
Posts: 246
Joined: Fri Jun 04, 2010 3:28 pm
Location: Hong Kong

Re: Camera to Character-animation

Post by smso »

804 wrote:I have to set a name for the joint while moddeling and then just call it in my code?
So in your example the name of the joint is "head" !?
A named joint node would make the code easier to understand. On the other hand, joint node can also be referred to by an id.

Code: Select all

virtual IBoneSceneNode* irr::scene::IAnimatedMeshSceneNode::getJointNode (u32 jointID);
The api docs are your friends.

Regards from smso.
Post Reply