本文整理汇总了C++中NxMat33::toQuat方法的典型用法代码示例。如果您正苦于以下问题:C++ NxMat33::toQuat方法的具体用法?C++ NxMat33::toQuat怎么用?C++ NxMat33::toQuat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NxMat33
的用法示例。
在下文中一共展示了NxMat33::toQuat方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updataBodyAndWheelNode
void Vehicle::updataBodyAndWheelNode(NxReal timeSinceLastFrame)
{//更新车身和轮子节点
NxQuat nxquat;
//更新父节点
mBaseCarNode->setPosition(mActor->getGlobalPosition().x, mActor->getGlobalPosition().y,
mActor->getGlobalPosition().z);
mActor->getGlobalOrientation().toQuat(nxquat);
mBaseCarNode->setOrientation(nxquat.w, nxquat.x, nxquat.y, nxquat.z);
//更新车身节点
//mBodyNode->setPosition(mBodyShape->getLocalPosition().x, mBodyShape->getLocalPosition().y,
// mBodyShape->getLocalPosition().z);
//mBodyShape->getLocalPose().M.toQuat(nxquat);
//mBodyNode->setOrientation(nxquat.w, nxquat.x, nxquat.y, nxquat.z);
//更新轮子节点
for (uint i = 0;i<mWheels.size();i++)
{
NxMat33 wheelMat;
NxMat33 steerMat, rollMat;
NxVec3 wheelPos;
NxWheelShape* wheel = mWheels[i].mWheel;
wheelPos = wheel->getLocalPosition();
//Ogre::Vector3 vec3(UtilityFunc::NxVec3_To_OgreVec3(mWheels[i].mWheel->getLocalPosition()));
//nxquat.fromAngleAxis(NxMath::radToDeg(mWheels[i].mWheel->getSteerAngle()), NxVec3(0, 1, 0));
//轮子角度
steerMat.rotY(wheel->getSteerAngle());
mRollAngle += wheel->getAxleSpeed() * timeSinceLastFrame;
//防溢出
while (mRollAngle > NxTwoPi)
mRollAngle -= NxTwoPi;
while (mRollAngle < -NxTwoPi)
mRollAngle += NxTwoPi;
//轮子转动
rollMat.rotX(mRollAngle);
wheelMat = steerMat * rollMat;
wheelMat.toQuat(nxquat);
NxWheelContactData wcd;
NxShape* shape = mWheels[i].mWheel->getContact(wcd);
if (shape)
{
NxReal radius = wheel->getRadius();
wheelPos.y += radius - wcd.contactPosition;
}
else
{
NxReal suspensionTravel = wheel->getSuspensionTravel();
wheelPos.y += -suspensionTravel;
}
mWheels[i].mSceneNode->setPosition(UtilityFunc::NxVec3_To_OgreVec3(wheelPos));
mWheels[i].mSceneNode->setOrientation(UtilityFunc::NxQuat_ToOgre_Quat(nxquat));
//mWheels[i].mSceneNode->rotate(Ogre::Vector3(1, 0, 0), Ogre::Radian(mRollAngle));
}
}