本文整理汇总了C++中IAttachment::IsAttachmentHidden方法的典型用法代码示例。如果您正苦于以下问题:C++ IAttachment::IsAttachmentHidden方法的具体用法?C++ IAttachment::IsAttachmentHidden怎么用?C++ IAttachment::IsAttachmentHidden使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IAttachment
的用法示例。
在下文中一共展示了IAttachment::IsAttachmentHidden方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetClosestAttachment
int CScriptBind_Actor::GetClosestAttachment(IFunctionHandler *pH, int characterSlot, Vec3 testPos, float maxDistance, const char* suffix)
{
CActor *pActor = GetActor(pH);
if (!pActor)
return pH->EndFunction();
IEntity* pEntity = pActor->GetEntity();
ICharacterInstance* pChar = pEntity->GetCharacter(characterSlot);
if (!pChar)
return pH->EndFunction();
//fallback: use nearest attachment
float minDiff = maxDistance*maxDistance;
IAttachment* pClosestAtt = 0;
IAttachmentManager* pMan = pChar->GetIAttachmentManager();
int count = pMan->GetAttachmentCount();
for (int i=0; i<count; ++i)
{
IAttachment* pAtt = pMan->GetInterfaceByIndex(i);
if (pAtt->IsAttachmentHidden() || !pAtt->GetIAttachmentObject())
continue;
AABB bbox(AABB::CreateTransformedAABB(Matrix34(pAtt->GetAttWorldAbsolute()),pAtt->GetIAttachmentObject()->GetAABB()));
//gEnv->pRenderer->GetIRenderAuxGeom()->DrawAABB(bbox,false,ColorB(255,0,0,100),eBBD_Faceted);
//float diff = (testPos - pAtt->GetWMatrix().GetTranslation()).len2();
float diff((testPos - bbox.GetCenter()).len2());
if (diff < minDiff)
{
//CryLogAlways("%s distance: %.1f", pAtt->GetName(), sqrt(diff));
if (suffix[0] && !strstr(pAtt->GetName(), suffix))
continue;
minDiff = diff;
pClosestAtt = pAtt;
}
}
if (!pClosestAtt)
return pH->EndFunction();
//FIXME FIXME: E3 workaround
char attachmentName[64];
strncpy(attachmentName,pClosestAtt->GetName(),63);
attachmentName[63] = 0;
char *pDotChar = strstr(attachmentName,".");
if (pDotChar)
*pDotChar = 0;
strlwr(attachmentName);
//
return pH->EndFunction(attachmentName);
}