本文整理汇总了C++中NxQuat::setXYZW方法的典型用法代码示例。如果您正苦于以下问题:C++ NxQuat::setXYZW方法的具体用法?C++ NxQuat::setXYZW怎么用?C++ NxQuat::setXYZW使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NxQuat
的用法示例。
在下文中一共展示了NxQuat::setXYZW方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetDirection
/***********************************************************
get direction vector
***********************************************************/
LbaVec3 LbaQuaternion::GetDirection(const LbaVec3 &vec)
{
NxVec3 dir(vec.x, vec.y, vec.z);
NxQuat current;
current.setXYZW(X, Y, Z, W);
current.rotate(dir);
return LbaVec3(dir.x, dir.y, dir.z);
}
示例2: AddRotation
/***********************************************************
add rotation to quaternion
***********************************************************/
void LbaQuaternion::AddRotation(float angle, LbaVec3 vec)
{
NxQuat q(angle, NxVec3(vec.x, vec.y, vec.z));
NxQuat current;
current.setXYZW(X, Y, Z, W);
current = q * current;
X = current.x;
Y = current.y;
Z = current.z;
W = current.w;
}
示例3: update
//.........这里部分代码省略.........
ActorData &convex = *it;
if(convex.createDelayCounter++ >= MAX_WAIT_FOR_CREATE)
continue;
boost::shared_ptr<PhysicsActor> actor = convex.actor.lock();
if(!actor)
continue;
boost::shared_ptr<PhysicsMesh> mesh = convex.mesh.lock();
if(!mesh)
continue;
/*
//VC3 boxCenter = mesh->localPosition + actor->position;
VC3 boxCenter = mesh->localPosition;
actor->rotation.RotateVector(boxCenter);
boxCenter += actor->position;
// Test to previous tick physics
if(data->physics->checkOverlapOBB(boxCenter, mesh->size, actor->rotation, physics::PhysicsLib::CollisionStatic))
{
convex.actor.reset();
convex.mesh.reset();
continue;
}
*/
#ifdef PHYSX_SPAWN_TEST
BoxStruct currentBox;
currentBox.center.set(boxCenter.x, boxCenter.y, boxCenter.z);
currentBox.extents.set(mesh->size.x, mesh->size.y, mesh->size.z);
QUAT r = actor->rotation.GetInverse();
NxQuat quat;
quat.setXYZW(r.x, r.y, r.z, r.w);
currentBox.rotation.fromQuat(quat);
// Test to previous tick physics
if(data->physics->checkOverlapOBB(boxCenter, mesh->size, actor->rotation))
continue;
bool hit = false;
for(unsigned int i = 0; i < previousBoxes.size(); ++i)
{
const BoxStruct &b = previousBoxes[i];
if(NxBoxBoxIntersect(currentBox.extents, currentBox.center, currentBox.rotation, b.extents, b.center, b.rotation, true))
{
hit = true;
break;
}
}
if(hit)
continue;
#endif
// Don't create too many particles
if(index++ >= createAmount)
break;
/*
boost::shared_ptr<physics::ConvexActor> convexActor = data->physics->createConvexActor(mesh->mesh, actor->position);
if(convexActor)
{
convexActor->setRotation(actor->rotation);
convexActor->setVelocity(convex.velocity);
convexActor->setAngularVelocity(convex.angularVelocity);
示例4: GetRotationSingleAngle
/***********************************************************
get object rotation on a single angle
***********************************************************/
float LbaQuaternion::GetRotationSingleAngle()
{
NxQuat current;
current.setXYZW(X, Y, Z, W);
return current.getAngle();
}