本文整理汇总了C++中CalBone::getRotationBoneSpace方法的典型用法代码示例。如果您正苦于以下问题:C++ CalBone::getRotationBoneSpace方法的具体用法?C++ CalBone::getRotationBoneSpace怎么用?C++ CalBone::getRotationBoneSpace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CalBone
的用法示例。
在下文中一共展示了CalBone::getRotationBoneSpace方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getRotationForParentBone
/// calculate a rotation to bring the current direction vector between parent and bone
/// to the given new direction vector (non-normalized)
ofxQuaternion IKCharacter::getRotationForParentBone( int bone_id, CalVector new_parent_to_bone_direction )
{
CalCoreSkeleton* core_skel = skeleton->getCoreSkeleton();
CalBone* bone = skeleton->getBone( bone_id );
int parent_id = core_skel->getCoreBone( bone_id )->getParentId();
CalBone* parent_bone = skeleton->getBone( parent_id );
int parent_parent_id = parent_bone->getCoreBone()->getParentId();
// don't rotate the base state
if ( parent_parent_id == -1 )
return ofxQuaternion();
// new_parent_to_bone_direction is currently in world-space
// we need to bring it into the space of the parent bone
CalQuaternion bone_space_rot = bone->getRotationBoneSpace();
bone_space_rot.invert();
new_parent_to_bone_direction *= bone_space_rot;
CalVector old_dir = bone->getTranslation();
CalVector new_dir = new_parent_to_bone_direction;
old_dir.normalize();
new_dir.normalize();
// rotate from one to the other
ofxQuaternion rot;
ofxVec3f od( old_dir.x, old_dir.y, old_dir.z );
ofxVec3f nd( new_dir.x, new_dir.y, new_dir.z );
rot.makeRotate( od, nd );
// return
return rot.inverse();
}
示例2: BoneGetRotateBoneSpace
/////////////////////////////////////
// Purpose: get the rotation
// to bring a point into the
// bone instance space
// Output: pQ set
// Return: none
/////////////////////////////////////
void IgfxObject::BoneGetRotateBoneSpace(s32 boneID, Quaternion *pQ)
{
if(m_pCalModel)
{
CalSkeleton *pSkel = m_pCalModel->getSkeleton();
CalBone *pBone = pSkel->getBone(boneID);
CalQuaternion cQuat = pBone->getRotationBoneSpace();
pQ->x = cQuat.x;
pQ->y = cQuat.y;
pQ->z = cQuat.z;
pQ->w = cQuat.w;
}
}