本文整理汇总了C++中NxShape::getGlobalPosition方法的典型用法代码示例。如果您正苦于以下问题:C++ NxShape::getGlobalPosition方法的具体用法?C++ NxShape::getGlobalPosition怎么用?C++ NxShape::getGlobalPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NxShape
的用法示例。
在下文中一共展示了NxShape::getGlobalPosition方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onTrigger
virtual void onTrigger(NxShape& triggerShape, NxShape& otherShape, NxTriggerFlag status)
{
// Get our trigger physical. This should definitely have a plPXPhysical
plPXPhysical* triggerPhys = (plPXPhysical*)triggerShape.getActor().userData;
bool doReport = false;
// Get the triggerer. This may be an avatar, which doesn't have a
// plPXPhysical, so we have to extract the necessary info.
plKey otherKey = nil;
hsPoint3 otherPos = plPXConvert::Point(otherShape.getGlobalPosition());
if (plSimulationMgr::fExtraProfile)
DetectorLogRed("-->%s %s (status=%x) [email protected](%f,%f,%f)",triggerPhys->GetObjectKey()->GetName().c_str(),status & NX_TRIGGER_ON_ENTER ? "enter" : "exit",status,otherPos.fX,otherPos.fY,otherPos.fZ);
plPXPhysical* otherPhys = (plPXPhysical*)otherShape.getActor().userData;
if (otherPhys)
{
otherKey = otherPhys->GetObjectKey();
doReport = triggerPhys->DoReportOn((plSimDefs::Group)otherPhys->GetGroup());
if (!doReport)
{
if (plSimulationMgr::fExtraProfile)
DetectorLogRed("<--Kill collision %s :failed group. US=%x OTHER=(%s)%x",triggerPhys->GetObjectKey()->GetName().c_str(),triggerPhys->GetGroup(),otherPhys->GetObjectKey()->GetName().c_str(),otherPhys->GetGroup());
}
}
else
{
bool isController;
plPXPhysicalControllerCore* controller = plPXPhysicalControllerCore::GetController(otherShape.getActor(),&isController);
if (controller)
{
if (isController)
{
#ifdef PHYSX_ONLY_TRIGGER_FROM_KINEMATIC
if (plSimulationMgr::fExtraProfile)
DetectorLogRed("<--Kill collision %s : ignoring controller events.",triggerPhys->GetObjectKey()->GetName().c_str());
return;
#else // else if trigger on both controller and kinematic
// only suppress controller collision 'enters' when disabled but let 'exits' continue
// ...this is because there are detector regions that are on the edge on ladders that the exit gets missed.
if ( ( !controller->IsEnabled() /*&& (status & NX_TRIGGER_ON_ENTER)*/ ) || controller->IsKinematic() )
{
if (plSimulationMgr::fExtraProfile)
DetectorLogRed("<--Kill collision %s : controller is not enabled.",triggerPhys->GetObjectKey()->GetName().c_str());
return;
}
#endif // PHYSX_ONLY_TRIGGER_FROM_KINEMATIC
}
#ifndef PHYSX_ONLY_TRIGGER_FROM_KINEMATIC // if triggering only kinematics, then all should trigger
else
{
// only suppress kinematic collision 'enters' when disabled but let 'exits' continue
// ...this is because there are detector regions that are on the edge on ladders that the exit gets missed.
if ( !controller->IsKinematic() /*&& (status & NX_TRIGGER_ON_ENTER) */ )
{
if (plSimulationMgr::fExtraProfile)
DetectorLogRed("<--Kill collision %s : kinematic is not enabled.",triggerPhys->GetObjectKey()->GetName().c_str());
return;
}
}
#endif // PHYSX_ONLY_TRIGGER_FROM_KINEMATIC
otherKey = controller->GetOwner();
doReport = triggerPhys->DoReportOn(plSimDefs::kGroupAvatar);
if (plSimulationMgr::fExtraProfile )
{
if (!doReport)
{
DetectorLogRed("<--Kill collision %s :failed group. US=%x OTHER=(NotAvatar)",triggerPhys->GetObjectKey()->GetName().c_str(),triggerPhys->GetGroup());
}
else
{
hsPoint3 avpos;
controller->GetPositionSim(avpos);
DetectorLogRed("-->Avatar at (%f,%f,%f)",avpos.fX,avpos.fY,avpos.fZ);
}
}
}
}
if (doReport)
{
#ifdef USE_PHYSX_CONVEXHULL_WORKAROUND
if ( triggerPhys->DoDetectorHullWorkaround() )
{
if (status & NX_TRIGGER_ON_ENTER && triggerPhys->Should_I_Trigger(status & NX_TRIGGER_ON_ENTER, otherPos) )
{
if (plSimulationMgr::fExtraProfile)
DetectorLogRed("-->Send Collision (CH) %s %s",triggerPhys->GetObjectKey()->GetName().c_str(),status & NX_TRIGGER_ON_ENTER ? "enter" : "exit");
plSimulationMgr::GetInstance()->AddCollisionMsg(triggerPhys->GetObjectKey(), otherKey, true);
}
else if (status & NX_TRIGGER_ON_ENTER)
{
if (plSimulationMgr::fExtraProfile)
DetectorLogRed("<--Kill collision %s :failed Should I trigger",triggerPhys->GetObjectKey()->GetName().c_str());
}
if (status & NX_TRIGGER_ON_LEAVE && triggerPhys->Should_I_Trigger(status & NX_TRIGGER_ON_ENTER, otherPos) )
{
if (plSimulationMgr::fExtraProfile)
DetectorLogRed("-->Send Collision (CH) %s %s",triggerPhys->GetObjectKey()->GetName().c_str(),status & NX_TRIGGER_ON_ENTER ? "enter" : "exit");
plSimulationMgr::GetInstance()->AddCollisionMsg(triggerPhys->GetObjectKey(), otherKey, false);
//.........这里部分代码省略.........