本文整理汇总了C++中IAttachment::GetAttModelRelative方法的典型用法代码示例。如果您正苦于以下问题:C++ IAttachment::GetAttModelRelative方法的具体用法?C++ IAttachment::GetAttModelRelative怎么用?C++ IAttachment::GetAttModelRelative使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IAttachment
的用法示例。
在下文中一共展示了IAttachment::GetAttModelRelative方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
//------------------------------------------------------------------------
const Matrix33 &CItem::GetSlotHelperRotation(int slot, const char *helper, bool worldSpace, bool relative)
{
static Matrix33 rotation;
rotation.SetIdentity();
IEntity* pEntity = GetEntity();
if(!pEntity)
return rotation;
SEntitySlotInfo info;
if (pEntity->GetSlotInfo(slot, info))
{
if (info.pStatObj)
{
IStatObj *pStatObj = info.pStatObj;
rotation = Matrix33(pStatObj->GetHelperTM(helper));
rotation.OrthonormalizeFast();
rotation = Matrix33(GetEntity()->GetSlotLocalTM(slot, false))*rotation;
}
else if (info.pCharacter)
{
ICharacterInstance *pCharacter = info.pCharacter;
if(!pCharacter)
return rotation;
IAttachment* pAttachment = pCharacter->GetIAttachmentManager()->GetInterfaceByName(helper);
if(pAttachment)
{
rotation = Matrix33(worldSpace ? pAttachment->GetAttWorldAbsolute().q : pAttachment->GetAttModelRelative().q);
return rotation;
}
else
{
ICharacterModelSkeleton* pICharacterModelSkeleton = pCharacter->GetICharacterModel()->GetICharacterModelSkeleton();
ISkeletonPose* pSkeletonPose = pCharacter->GetISkeletonPose();
int16 id = pICharacterModelSkeleton->GetJointIDByName(helper);
if (id > -1)
{
rotation = relative ? Matrix33(pSkeletonPose->GetRelJointByID(id).q) : Matrix33(pSkeletonPose->GetAbsJointByID(id).q);
}
}
if (!relative)
{
rotation = Matrix33(pEntity->GetSlotLocalTM(slot, false)) * rotation;
}
}
}
if (worldSpace)
{
rotation = Matrix33(pEntity->GetWorldTM()) * rotation;
}
return rotation;
}
示例2: GetSlotHelperPos
//------------------------------------------------------------------------
Vec3 CItem::GetSlotHelperPos(int slot, const char *helper, bool worldSpace, bool relative) const
{
Vec3 position(0,0,0);
SEntitySlotInfo info;
if (GetEntity()->GetSlotInfo(slot, info))
{
if (info.pStatObj)
{
IStatObj *pStatsObj = info.pStatObj;
position = pStatsObj->GetHelperPos(helper);
position = GetEntity()->GetSlotLocalTM(slot, false).TransformPoint(position);
}
else if (info.pCharacter)
{
ICharacterInstance *pCharacter = info.pCharacter;
IAttachment* pAttachment = pCharacter->GetIAttachmentManager()->GetInterfaceByName(helper);
if (pAttachment)
{
position = worldSpace ? pAttachment->GetAttWorldAbsolute().t : pAttachment->GetAttModelRelative().t;
return position;
}
else
{
ICharacterModelSkeleton* pICharacterModelSkeleton = pCharacter->GetICharacterModel()->GetICharacterModelSkeleton();
ISkeletonPose* pSkeletonPose = pCharacter->GetISkeletonPose();
int16 id = pICharacterModelSkeleton->GetJointIDByName(helper);
if (id > -1)
{
position = relative ? pSkeletonPose->GetRelJointByID(id).t : pSkeletonPose->GetAbsJointByID(id).t;
}
}
if (!relative)
{
position = GetEntity()->GetSlotLocalTM(slot, false).TransformPoint(position);
}
}
}
if (worldSpace)
{
position = GetWorldTM().TransformPoint(position);
}
return position;
}