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.

Camera to Character-animation

Postby 804 » Fri Jan 20, 2012 12:06 pm

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

Re: Camera to Character-animation

Postby smso » Fri Jan 20, 2012 4:32 pm

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

cpp Code: Select all
scene::IAnimatedMeshSceneNode* node = ...
scene::IBoneSceneNode* head = node->getJointNode("head");
if (head)
     camera->setParent(head);


Regards from smso
smso
 
Posts: 217
Joined: Fri Jun 04, 2010 3:28 pm
Location: Hong Kong

Re: Camera to Character-animation

Postby 804 » Fri Jan 20, 2012 4:46 pm

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

Re: Camera to Character-animation

Postby smso » Fri Jan 20, 2012 6:02 pm

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.

cpp Code: Select all
virtual IBoneSceneNode* irr::scene::IAnimatedMeshSceneNode::getJointNode (u32 jointID);


The api docs are your friends.

Regards from smso.
smso
 
Posts: 217
Joined: Fri Jun 04, 2010 3:28 pm
Location: Hong Kong


Return to Beginners Help

Who is online

Users browsing this forum: No registered users and 1 guest