how to get bone tip position?

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
Post Reply
Ryan0805
Gnoblar
Posts: 3
Joined: Tue Aug 25, 2020 3:09 am

how to get bone tip position?

Post by Ryan0805 »

Hi,

my problem is similar to this post: viewtopic.php?t=49689

Image

I can get bone's position using _getDerivedPosition() function. However, I can't get the tip position since bone3 doesn't have child bone.

Is there a way to get the position of the tip?

Thank you.
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5296
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1278
Contact:

Re: how to get bone tip position?

Post by dark_sylinc »

Ryan0805 wrote: Tue Aug 25, 2020 3:36 am I can get bone's position using _getDerivedPosition() function. However, I can't get the tip position since bone3 doesn't have child bone.

Is there a way to get the position of the tip?
That information is lost because it is not exported. Only the head's data is exported.

You can assume the bone to be of a certain size (e.g. 1 unit) and see if it has been preserved through scale: e.g.

Code: Select all

pos = bone3->_getDerivedPosition();
rot = bone3->_getDerivedOrientation();
scale = bone3->_getDerivedScale();

tip = pos + rot * scale.z;
But I can't guarantee this will get you the same exact result as what you are seeing in Blender/Maya/etc. The orientation will be correct but how large the bone is may be wrong.
Ryan0805
Gnoblar
Posts: 3
Joined: Tue Aug 25, 2020 3:09 am

Re: how to get bone tip position?

Post by Ryan0805 »

I see. i'll get the scale factor in Blender.

Thank you!
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5296
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1278
Contact:

Re: how to get bone tip position?

Post by dark_sylinc »

Btw a much better workaround would be to create a dummy child node; since the child's head is essentially the parent's tip
Ryan0805
Gnoblar
Posts: 3
Joined: Tue Aug 25, 2020 3:09 am

Re: how to get bone tip position?

Post by Ryan0805 »

Code: Select all

Bone *dummy = bone3->createChild(handle, translate, rotate);
Yeah but creating dummy child need translate vector relative to bone3.
So I still need to get the scale factor in Blender. Or am I using the wrong function?
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5296
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1278
Contact:

Re: how to get bone tip position?

Post by dark_sylinc »

I meant creating a child bone in Blender
Post Reply