本文整理汇总了C++中ISkeletonPose::GetRelJointByID方法的典型用法代码示例。如果您正苦于以下问题:C++ ISkeletonPose::GetRelJointByID方法的具体用法?C++ ISkeletonPose::GetRelJointByID怎么用?C++ ISkeletonPose::GetRelJointByID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISkeletonPose
的用法示例。
在下文中一共展示了ISkeletonPose::GetRelJointByID方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DiscoverConvoyCoaches
void CFlowConvoyNode::DiscoverConvoyCoaches(IEntity *pEntity)
{
m_coaches.resize(0);
while (pEntity)
{
SConvoyCoach tc;
ICharacterInstance *pCharacterInstance = pEntity->GetCharacter(0);
ISkeletonPose *pSkeletonPose = pCharacterInstance ? pCharacterInstance->GetISkeletonPose() : NULL;
ICharacterModelSkeleton* pICharacterModelSkeleton = pCharacterInstance ? pCharacterInstance->GetICharacterModel()->GetICharacterModelSkeleton() : NULL;
IPhysicalEntity* pPhysics = pEntity->GetPhysics();
if(!pPhysics)
{
// don't need physics here, but need it later, so don't use entity if it's not physicalized
GameWarning("Convoy entity [%s] is not physicalized", pEntity->GetName());
break;
}
AABB bbox;
pEntity->GetLocalBounds(bbox);
//tc.m_coachOffset = (bbox.max.y - bbox.min.y) * .5f;
tc.m_coachOffset = 10.0f;
tc.m_frontWheelBase = pICharacterModelSkeleton ? pICharacterModelSkeleton->GetJointIDByName("wheel_base1") : -1;
tc.m_backWheelBase = pICharacterModelSkeleton ? pICharacterModelSkeleton->GetJointIDByName("wheel_base2") : -1;
if (tc.m_frontWheelBase >=0 && tc.m_backWheelBase >= 0)
{
QuatT qt1 = pSkeletonPose->GetRelJointByID(tc.m_frontWheelBase);
QuatT qt2 = pSkeletonPose->GetRelJointByID(tc.m_backWheelBase);
tc.m_wheelDistance = qt1.t.GetDistance(qt2.t) * .5f;
}
else
{
// Fallback for entities that don't have wheel_base joints
if ( m_bXAxisFwd )
tc.m_wheelDistance = (bbox.max.x - bbox.min.x) * .5f;
else
tc.m_wheelDistance = (bbox.max.y - bbox.min.y) * .5f;
}
tc.m_pEntity = pEntity;
// pEntity->SetConvoyEntity();
//for (int i = 0; i < pEntity->GetChildCount(); i++)
// pEntity->GetChild(i)->SetConvoyEntity();
//tc.m_pEntitySoundsProxy = (IEntitySoundProxy*) tc.m_pEntity->CreateProxy(ENTITY_PROXY_SOUND);
//assert(tc.m_pEntitySoundsProxy);
m_coaches.push_back(tc);
IEntityLink *pEntityLink = pEntity->GetEntityLinks();
pEntity = pEntityLink ? gEnv->pEntitySystem->GetEntity(pEntityLink->entityId) : NULL;
}
}
示例2: 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;
}
示例3: 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;
}
示例4: GetJointRelative
QuatT CScriptbind_Entity::GetJointRelative(IEntity *pEntity, mono::string jointName, int characterSlot)
{
if(ICharacterInstance *pCharacter = pEntity->GetCharacter(characterSlot))
{
const IDefaultSkeleton *pDefaultSkeleton = &pCharacter->GetIDefaultSkeleton();
ISkeletonPose *pSkeletonPose = pCharacter->GetISkeletonPose();
if (pSkeletonPose != nullptr)
{
int16 id = pDefaultSkeleton->GetJointIDByName(ToCryString(jointName));
if (id > -1)
return pSkeletonPose->GetRelJointByID(id);
}
}
return QuatT();
}
示例5: InitGeometry
//------------------------------------------------------------------------
void CVehiclePartAnimated::InitGeometry()
{
if (!m_pSharedParameters->m_filename.empty())
{
m_slot = GetEntity()->LoadCharacter(m_slot, m_pSharedParameters->m_filename.c_str());
m_pCharInstance = GetEntity()->GetCharacter(m_slot);
if (m_pCharInstance)
{
if (m_pCharInstance->GetIMaterial() && !GetEntity()->GetMaterial())
{
SetMaterial(m_pCharInstance->GetIMaterial());
}
ISkeletonAnim* pSkeletonAnim = m_pCharInstance->GetISkeletonAnim();
ISkeletonPose* pSkeletonPose = m_pCharInstance->GetISkeletonPose();
IDefaultSkeleton &rIDefaultSkeleton = m_pCharInstance->GetIDefaultSkeleton();
if (pSkeletonAnim)
pSkeletonAnim->StopAnimationsAllLayers();
if (m_hideCount == 0)
GetEntity()->SetSlotFlags(m_slot, GetEntity()->GetSlotFlags(m_slot) | ENTITY_SLOT_RENDER);
else
GetEntity()->SetSlotFlags(m_slot, GetEntity()->GetSlotFlags(m_slot) & ~(ENTITY_SLOT_RENDER | ENTITY_SLOT_RENDER_NEAREST));
#if ENABLE_VEHICLE_DEBUG
if (IsDebugParts())
{
CryLog("joint transformations for %s", m_pCharInstance->GetFilePath());
for (int i = 0; i < rIDefaultSkeleton.GetJointCount(); ++i)
{
VehicleUtils::LogMatrix(rIDefaultSkeleton.GetJointNameByID(i), Matrix34(pSkeletonPose->GetRelJointByID(i)));
}
}
#endif
}
if (!m_pCharInstanceDestroyed && !m_pSharedParameters->m_filenameDestroyed.empty())
m_pCharInstanceDestroyed = gEnv->pCharacterManager->CreateInstance(m_pSharedParameters->m_filenameDestroyed.c_str());
if (m_pCharInstanceDestroyed)
{
m_pCharInstanceDestroyed->AddRef();
#if ENABLE_VEHICLE_DEBUG
if (IsDebugParts())
{
CryLog("joint transformations for %s", m_pCharInstanceDestroyed->GetFilePath());
ISkeletonPose* pSkeletonDestroyed = m_pCharInstanceDestroyed->GetISkeletonPose();
IDefaultSkeleton &rIDefaultSkeleton = m_pCharInstanceDestroyed->GetIDefaultSkeleton();
for (int i = 0; i < rIDefaultSkeleton.GetJointCount(); ++i)
{
VehicleUtils::LogMatrix(rIDefaultSkeleton.GetJointNameByID(i), Matrix34(pSkeletonDestroyed->GetRelJointByID(i)));
}
}
#endif
}
}
if (m_pSharedParameters->m_isPhysicalized && m_slot > -1)
GetEntity()->UnphysicalizeSlot(m_slot);
if (m_pCharInstance)
{
m_pCharInstance->GetISkeletonAnim()->StopAnimationsAllLayers();
if (m_hideCount == 0)
GetEntity()->SetSlotFlags(m_slot, GetEntity()->GetSlotFlags(m_slot) | ENTITY_SLOT_RENDER);
else
GetEntity()->SetSlotFlags(m_slot, GetEntity()->GetSlotFlags(m_slot) & ~(ENTITY_SLOT_RENDER | ENTITY_SLOT_RENDER_NEAREST));
}
// Disable hand-placed (static) decals on vehicles
GetEntity()->SetFlags(GetEntity()->GetFlags() | ENTITY_FLAG_NO_DECALNODE_DECALS);
}