本文整理汇总了C++中CClientPed::GetCurrentRotation方法的典型用法代码示例。如果您正苦于以下问题:C++ CClientPed::GetCurrentRotation方法的具体用法?C++ CClientPed::GetCurrentRotation怎么用?C++ CClientPed::GetCurrentRotation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CClientPed
的用法示例。
在下文中一共展示了CClientPed::GetCurrentRotation方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateContacting
//
// Apply object movement to contacting peds
//
void CDeathmatchObject::UpdateContacting(const CVector& vecCenterOfRotation, const CVector& vecFrameTranslation, const CVector& vecFrameRotation)
{
bool bHasRotation = (vecFrameRotation.fX != 0 || vecFrameRotation.fY != 0 || vecFrameRotation.fZ != 0);
bool bHasTranslation = (vecFrameTranslation.fX != 0 || vecFrameTranslation.fY != 0 || vecFrameTranslation.fZ != 0);
// Early out if no orientation change here
if (!bHasRotation && !bHasTranslation)
return;
// Step through each contacting ped
list<CClientPed*>::iterator iter = m_Contacts.begin();
for (; iter != m_Contacts.end(); ++iter)
{
CClientPed* pPed = *iter;
// Do not move the ped if it is frozen
if (pPed->IsFrozen())
continue;
// Get ped start position
CVector vecPlayerPosition;
pPed->GetPosition(vecPlayerPosition);
// Apply rotation effect on position
if (bHasRotation)
{
vecPlayerPosition -= vecCenterOfRotation;
RotateVector(vecPlayerPosition, CVector(-vecFrameRotation.fX, -vecFrameRotation.fY, -vecFrameRotation.fZ));
vecPlayerPosition += vecCenterOfRotation;
}
// Apply translation
vecPlayerPosition += vecFrameTranslation;
pPed->SetPosition(vecPlayerPosition);
// Also change ped facing direction
if (vecFrameRotation.fZ != 0)
{
float fRotationZ = pPed->GetCurrentRotation();
pPed->SetCurrentRotation(fRotationZ + vecFrameRotation.fZ);
}
}
// Look in attached objects for more ped contacts
for (uint i = 0; i < m_AttachedEntities.size(); ++i)
{
CClientEntity* pEntity = m_AttachedEntities[i];
if (IS_OBJECT(pEntity))
{
CDeathmatchObject* pObject = static_cast<CDeathmatchObject*>(pEntity);
pObject->UpdateContacting(vecCenterOfRotation, vecFrameTranslation, vecFrameRotation);
}
}
}