本文整理汇总了C++中ogre::Bone::getInitialPosition方法的典型用法代码示例。如果您正苦于以下问题:C++ Bone::getInitialPosition方法的具体用法?C++ Bone::getInitialPosition怎么用?C++ Bone::getInitialPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::Bone
的用法示例。
在下文中一共展示了Bone::getInitialPosition方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: frameRenderingQueued
bool OgreSmartBody::frameRenderingQueued(const Ogre::FrameEvent& evt)
{
if(mWindow->isClosed())
return false;
//Need to capture/update each device
mKeyboard->capture();
mMouse->capture();
if(mKeyboard->isKeyDown(OIS::KC_ESCAPE))
return false;
// smartbody
if (!m_pScene)
return true;
SmartBody::SBSimulationManager* sim = m_pScene->getSimulationManager();
sim->setTime((Ogre::Root::getSingleton().getTimer()->getMilliseconds() / 1000.0f) - mStartTime);
m_pScene->update();
int numCharacters = m_pScene->getNumCharacters();
if (numCharacters == 0)
return true;
const std::vector<std::string>& characterNames = m_pScene->getCharacterNames();
for (size_t n = 0; n < characterNames.size(); n++)
{
SmartBody::SBCharacter* character = m_pScene->getCharacter(characterNames[n]);
if (!this->getSceneManager()->hasEntity(characterNames[n]))
continue;
Ogre::Entity* entity = this->getSceneManager()->getEntity(characterNames[n]);
Ogre::Skeleton* meshSkel = entity->getSkeleton();
Ogre::Node* node = entity->getParentNode();
SrVec pos = character->getPosition();
SrQuat ori = character->getOrientation();
//std::cout << ori.w << ori.x << " " << ori.y << " " << ori.z << std::endl;
node->setPosition(pos.x, pos.y, pos.z);
node->setOrientation(ori.w, ori.x, ori.y, ori.z);
// Update joints
SmartBody::SBSkeleton* sbSkel = character->getSkeleton();
int numJoints = sbSkel->getNumJoints();
for (int j = 0; j < numJoints; j++)
{
SmartBody::SBJoint* joint = sbSkel->getJoint(j);
try
{
SrQuat orientation = joint->quat()->value();
Ogre::Vector3 posDelta(joint->getPosition().x, joint->getPosition().y, joint->getPosition().z);
Ogre::Quaternion quatDelta(orientation.w, orientation.x, orientation.y, orientation.z);
Ogre::Bone* bone = meshSkel->getBone(joint->getName());
if (!bone)
continue;
bone->setPosition(bone->getInitialPosition() + posDelta);
bone->setOrientation(quatDelta);
}
catch (Ogre::ItemIdentityException& ex)
{
// Should not happen as we filtered using m_mValidBones
}
}
}
return true;
}
示例2: getBoneInitialPosition
Vector3 GfxBody::getBoneInitialPosition (unsigned n)
{
checkBone(n);
Ogre::Bone *bone = skeleton->getBone(n);
return from_ogre(bone->getInitialPosition());
}