本文整理汇总了C++中NxShape::isCapsule方法的典型用法代码示例。如果您正苦于以下问题:C++ NxShape::isCapsule方法的具体用法?C++ NxShape::isCapsule怎么用?C++ NxShape::isCapsule使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NxShape
的用法示例。
在下文中一共展示了NxShape::isCapsule方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReleaseActorCapsule
void CPhysicsManager::ReleaseActorCapsule (CPhysicActor* actor)
{
assert(actor != NULL);
assert(m_pScene != NULL);
assert(m_pPhysicsSDK != NULL);
NxActor* nxActor = actor->GetPhXActor();
if( nxActor != 0)
{
NxArray<NxCCDSkeleton*> skeletons;
for (NxU32 i = 0; i < nxActor->getNbShapes(); i++)
{
NxShape* shape = nxActor->getShapes()[i];
if (shape->isCapsule())
shape->setGroup(ECG_LAST_GROUP);
}
}
}
示例2: AddVisualization
void CPhysicsActor::AddVisualization()
{
// get the CPhysicsObject's name
PHYSICSUSERDATA* userData = (PHYSICSUSERDATA*)m_Actor->userData;
if( userData == NULL )
return;
CPhysicsObject* physObj = userData->physObj;
IHashString* cpoName = physObj->GetParentName();
// Loop through shapes in the actor
unsigned int numShapes = m_Actor->getNbShapes();
NxShape*const* shapes = m_Actor->getShapes();
NxShape* shape;
// we need to unscale before feeding it to the shape objects since they
// get the scale from the parent
Vec3 invScale;
invScale.x = 1.0f / m_CurrentScale.x;
invScale.y = 1.0f / m_CurrentScale.y;
invScale.z = 1.0f / m_CurrentScale.z;
// Add visualizations for each shape
while( numShapes-- )
{
shape = shapes[numShapes];
// Add shape to be rendered
if( shape->isBox() )
{
NxBoxShape* boxShape = (NxBoxShape*)shape;
Matrix4x4 localTransform;
localTransform.SetIdentity();
float tempRot[9];
boxShape->getLocalOrientation().getColumnMajor( tempRot );
localTransform.SetFrom3x3( tempRot );
NxVec3 tempPos = boxShape->getLocalPosition();
tempPos.x *= invScale.x;
tempPos.y *= invScale.y;
tempPos.z *= invScale.z;
localTransform.SetTranslation( Vec3(tempPos.x, tempPos.y, tempPos.z) );
NxVec3 boxDimensions = boxShape->getDimensions();
float halfXDimension = boxDimensions.x * invScale.x;
float halfYDimension = boxDimensions.y * invScale.y;
float halfZDimension = boxDimensions.z * invScale.z;
// Add a debug render object to visualize the object
ADDOBJECTORIENTEDBOXPARAMS oobbParams;
oobbParams.name = cpoName;
oobbParams.min = Vec3( -halfXDimension, -halfYDimension, -halfZDimension );
oobbParams.max = Vec3( halfXDimension, halfYDimension, halfZDimension );
oobbParams.localTransform = localTransform;
static DWORD msgHash_AddObjectOrientedBox = CHashString(_T("AddObjectOrientedBox")).GetUniqueID();
m_ToolBox->SendMessage(msgHash_AddObjectOrientedBox, sizeof(ADDOBJECTORIENTEDBOXPARAMS), &oobbParams );
}
if( shape->isSphere() )
{
NxSphereShape* sphereShape = (NxSphereShape*)shape;
float radius = sphereShape->getRadius();
// Add a debug render object to visualize the object
ADDSPHEREPARAMS sphereParams;
sphereParams.name = cpoName;
sphereParams.radius = radius * invScale.x;
sphereParams.red = 0;
sphereParams.green = 255; // making the sphere green to distinguish it from AABBs
sphereParams.blue = 0;
static DWORD msgHash_AddSphere = CHashString(_T("AddSphere")).GetUniqueID();
m_ToolBox->SendMessage(msgHash_AddSphere, sizeof(ADDSPHEREPARAMS), &sphereParams );
}
if( shape->isCapsule() )
{
// Draw as a red box for now
NxCapsuleShape* capsuleShape = (NxCapsuleShape*)shape;
Matrix4x4 localTransform;
localTransform.SetIdentity();
float tempRot[9];
capsuleShape->getLocalOrientation().getColumnMajor( tempRot );
localTransform.SetFrom3x3( tempRot );
NxVec3 tempPos = capsuleShape->getLocalPosition();
tempPos.x *= invScale.x;
tempPos.y *= invScale.y;
tempPos.z *= invScale.z;
localTransform.SetTranslation( Vec3(tempPos.x, tempPos.y, tempPos.z) );
float halfXDimension = capsuleShape->getRadius();
float halfYDimension = capsuleShape->getHeight() - capsuleShape->getRadius();
float halfZDimension = capsuleShape->getRadius();
// Add a debug render object to visualize the object
ADDOBJECTORIENTEDBOXPARAMS oobbParams;
//.........这里部分代码省略.........