本文整理汇总了C++中NxActor::getLinearMomentum方法的典型用法代码示例。如果您正苦于以下问题:C++ NxActor::getLinearMomentum方法的具体用法?C++ NxActor::getLinearMomentum怎么用?C++ NxActor::getLinearMomentum使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NxActor
的用法示例。
在下文中一共展示了NxActor::getLinearMomentum方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetPMan
pRigidBody*pFactory::cloneRigidBody(CK3dEntity *src,CK3dEntity *dst,CKDependencies *deps,int copyFlags,int bodyFlags/* =0 */)
{
//src->Rest
pRigidBody *result = GetPMan()->getBody(dst);
pRigidBody *srcBody = GetPMan()->getBody(src);
CK3dEntity *referenceObject = dst;
XString errMsg;
pObjectDescr oDescr;
//----------------------------------------------------------------
//
// sanity checks
//
#ifdef _DEBUG
assert(src);
assert(dst);
#endif // _DEBUG
if (!(copyFlags & PB_CF_PHYSICS))
{
errMsg.Format("Nothing to copy, aborting");
xLogger::xLog(XL_START,ELOGWARNING,E_LI_MANAGER,errMsg.Str());
return NULL;
}
//iAssertW(!result,"","Object :%s already physicalized");
//----------------------------------------------------------------
//
// fill object description
//
if (!result && IParameter::Instance()->copyTo(oDescr,src,copyFlags))
{
pWorld *world = GetPMan()->getWorld(oDescr.worlReference) ? GetPMan()->getWorld(oDescr.worlReference) : GetPMan()->getDefaultWorld();
if(world)
{
if ( (copyFlags && PB_CF_OVRRIDE_BODY_FLAGS) )
oDescr.flags = (BodyFlags)bodyFlags;
//now create the final rigid body :
result = pFactory::Instance()->createRigidBody(dst,oDescr);
}
}
if (!result){
xLogger::xLog(XL_START,ELOGERROR,E_LI_MANAGER,"cloning failed");
return NULL;
}
//----------------------------------------------------------------
//
// clone joints
//
if ( (copyFlags & PB_CF_JOINTS) )
{
pFactory::cloneJoints(src,dst,copyFlags);
}
//----------------------------------------------------------------
//
// copy velocities
//
if ( (copyFlags & PB_CF_VELOCITIES) )
{
NxActor *actorSrc = srcBody->getActor();
NxActor *actorDst = result->getActor();
actorDst->setLinearVelocity( actorSrc->getLinearVelocity() );
actorDst->setAngularVelocity( actorSrc->getAngularVelocity() );
}
//----------------------------------------------------------------
//
// copy forces
//
if ( (copyFlags & PB_CF_FORCE) )
{
NxActor *actorSrc = srcBody->getActor();
NxActor *actorDst = result->getActor();
actorDst->setLinearMomentum( actorSrc->getLinearMomentum() );
actorDst->setAngularMomentum( actorSrc->getAngularMomentum() );
}
//----------------------------------------------------------------
//
// copy sub shapes if :
//
// "Copy Children In Dependencies" &&
// ( copyFlags::OverrideBodyFlags & hierarchy && newBodyFlags & hierarchy ) ||
// ( oldBodyFlags & hierarchy )
if ( ((*deps->At(CKCID_3DENTITY)) & CK_DEPENDENCIES_COPY_3DENTITY_CHILDREN) &&
( (( copyFlags & PB_CF_OVRRIDE_BODY_FLAGS ) && (bodyFlags & BF_Hierarchy)) ||
( oDescr.flags & BF_Hierarchy) )
)
{
int dCount = dst->GetChildrenCount();
CK3dEntity* subEntity = NULL;
//.........这里部分代码省略.........