Rotating certain parts of an animating skeleton?

Anything and everything that's related to OGRE or the wider graphics field that doesn't fit into the other forums.
Post Reply
InfinityComplex
Halfling
Posts: 41
Joined: Mon Jul 04, 2005 11:24 pm

Rotating certain parts of an animating skeleton?

Post by InfinityComplex »

Hi,

Is it possible to rotate individual parts of a skeleton while animating?

For example,

Code: Select all

  Waist = MyMesh->GetChildNode( "Waist")
And then roll/yaw it or directly supply a new matrix?
User avatar
SuprChikn
Bugbear
Posts: 863
Joined: Tue Apr 19, 2005 6:10 am
Location: Melbourne, Aus
Contact:

Post by SuprChikn »

Wouldn't you want to get a pointer (or whatever) to a bone in the skeleton, and rotate that as needed?
And yes, this is possible.

You should be able to do something like (this has not been tested btw):

Code: Select all

Ogre::Bone* waist = MyEntity->getSkeleton()->getBone ("Waist");
waist->yaw(Radian(Math::PI));
where "Waist" is the name of a bone in the skeleton associated with the MyEntity mesh.

Asside from yaw, you also have roll, pitch, rotate, scale, and setOrientation (amongst other things). If you don't already have some working knowledge of Quaternions, it might come in handy for some of this (here is a handy introduction to them in the wiki, thanks to discipline).
Have a look at the API docs for more info.
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 66
Contact:

Post by sinbad »

InfinityComplex
Halfling
Posts: 41
Joined: Mon Jul 04, 2005 11:24 pm

Post by InfinityComplex »

Thanks. I got most of it solved by checking the api docs, starting to get my head around it all.

One quick question, I have a little bone iterator set up to display the names of all bones attached to a skeleton, but I can't seem to convert the returned data from Bone->getName() into a valid string for printf()

I tried,

Const Char *dat =(Const Char *) tbone->getName()

to cast it but it produces a compile time error in devC++.

Anyone know of a way?
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 66
Contact:

Post by sinbad »

Eeeek! ;)

You can use the c_str() method to convert to a horrid old C-string if you really must. But really you should just toss out all those horrid unsafe C functions and use the STL instead (iostream does a far better job than printf any day).
User avatar
Kentamanos
Minaton
Posts: 980
Joined: Sat Aug 07, 2004 12:08 am
Location: Dallas, TX

Post by Kentamanos »

sinbad wrote:Eeeek! ;)

You can use the c_str() method to convert to a horrid old C-string if you really must. But really you should just toss out all those horrid unsafe C functions and use the STL instead (iostream does a far better job than printf any day).
Just a quick comment/question...

VS 2005 is generating warnings about functions like strstr etc. being deprecated in some spots in OGRE. Should we potentially try to remove all "old school" strings and operations in favor of std::string stuff?
Post Reply