本文整理汇总了C++中ogre::Quaternion::equals方法的典型用法代码示例。如果您正苦于以下问题:C++ Quaternion::equals方法的具体用法?C++ Quaternion::equals怎么用?C++ Quaternion::equals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::Quaternion
的用法示例。
在下文中一共展示了Quaternion::equals方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: snapTpPortal
//-------------------------------------------------------------------------------
bool PortalEditor::snapTpPortal(PortalEditor* dest,bool bAllowMove )
{
//reposition & realign this portal (and its parent zone)
//to connect with this portal.
//Before snapping portals togther, we should check that the zone is
//not already locked into position by another portal join.
//However, even if this is the case, we can still join portals if
//they are already in the correct position.
//get current position data:
Ogre::Quaternion qZone = mParentZone->getDerivedOrientation();
Ogre::Quaternion qDest = dest->getDerivedOrientation();
Ogre::Quaternion qPortal = this->getOrientation();
Ogre::Vector3 vDest = dest->getDerivedPosition();
Ogre::Vector3 vPortal = this->getDerivedPosition();
const Ogre::Real DIST_EPSILON(0.01f);//fudge factor
const Ogre::Radian ANG_EPSILON(0.01f);
if(vPortal.distance(vDest)<DIST_EPSILON && qPortal.equals(qDest*Ogre::Quaternion(0,0,1,0),ANG_EPSILON))return true;
if(!bAllowMove)return false;
//orientation
Ogre::Quaternion qNew = (qDest*Ogre::Quaternion(0,0,1,0))*qPortal.Inverse();
mParentZone->setDerivedOrientation(qNew);
//position
Ogre::Vector3 vZone = mParentZone->getDerivedPosition();
vPortal = this->getDerivedPosition();
mParentZone->setDerivedPosition( (vDest - (vPortal-vZone)));
return true;
}
示例2: setRotation
void PhysicActor::setRotation(const Ogre::Quaternion &quat)
{
if(!quat.equals(getRotation(), Ogre::Radian(0))){
mEngine->adjustRigidBody(mBody, getPosition(), quat, mBoxScaledTranslation, mBoxRotation);
mEngine->adjustRigidBody(mRaycastingBody, getPosition(), quat, mBoxScaledTranslation, mBoxRotation);
}
}