本文整理汇总了C++中IActor::GetViewRotation方法的典型用法代码示例。如果您正苦于以下问题:C++ IActor::GetViewRotation方法的具体用法?C++ IActor::GetViewRotation怎么用?C++ IActor::GetViewRotation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IActor
的用法示例。
在下文中一共展示了IActor::GetViewRotation方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnInitiate
//------------------------------------------------------------------------
bool CGameRules::OnInitiate(SHostMigrationInfo& hostMigrationInfo, uint32& state)
{
if (!g_pGame->GetIGameFramework()->ShouldMigrateNub(hostMigrationInfo.m_session))
{
return true;
}
CryLog("[Host Migration]: CGameRules::OnInitiate() Saving character for host migration started");
m_hostMigrationClientHasRejoined = false;
IEntityScriptProxy* pScriptProxy = static_cast<IEntityScriptProxy*>(GetEntity()->GetProxy(ENTITY_PROXY_SCRIPT));
if (pScriptProxy)
{
if (string(pScriptProxy->GetState()) == "InGame")
{
m_hostMigrationTimeSinceGameStarted = (m_cachedServerTime - m_gameStartedTime);
}
}
HostMigrationStopAddingPlayers();
if (gEnv->IsClient())
{
if (!m_pHostMigrationParams)
{
m_pHostMigrationParams = new SHostMigrationClientRequestParams();
m_pHostMigrationClientParams = new SHostMigrationClientControlledParams();
}
IActor *pPlayer = g_pGame->GetIGameFramework()->GetClientActor();
if (pPlayer)
{
m_pHostMigrationClientParams->m_viewQuat = pPlayer->GetViewRotation();
m_pHostMigrationClientParams->m_position = pPlayer->GetEntity()->GetPos();
pe_status_living livStat;
IPhysicalEntity *pPhysicalEntity = pPlayer->GetEntity()->GetPhysics();
if (pPhysicalEntity != NULL && (pPhysicalEntity->GetType() == PE_LIVING) && (pPhysicalEntity->GetStatus(&livStat) > 0))
{
m_pHostMigrationClientParams->m_velocity = livStat.velUnconstrained;
m_pHostMigrationClientParams->m_hasValidVelocity = true;
CryLog(" velocity={%f,%f,%f}", m_pHostMigrationClientParams->m_velocity.x, m_pHostMigrationClientParams->m_velocity.y, m_pHostMigrationClientParams->m_velocity.z);
}
IInventory *pInventory = pPlayer->GetInventory();
m_pHostMigrationClientParams->m_numExpectedItems = 0;
int numAmmoTypes = 0;
m_pHostMigrationClientParams->m_pAmmoParams = new SHostMigrationClientControlledParams::SAmmoParams[numAmmoTypes];
m_pHostMigrationClientParams->m_numAmmoParams = numAmmoTypes;
/*CryLog(" player has %i different ammo types", numAmmoTypes);
for (int i = 0; i < numAmmoTypes; ++ i)
{
IEntityClass *pAmmoType = pInventory->GetAmmoType(i);
int ammoCount = pInventory->GetAmmoCount(pAmmoType);
m_pHostMigrationClientParams->m_pAmmoParams[i].m_pAmmoClass = pAmmoType;
m_pHostMigrationClientParams->m_pAmmoParams[i].m_count = ammoCount;
CryLog(" %s : %i", pAmmoType->GetName(), ammoCount);
}*
EntityId holseredItemId = pInventory->GetHolsteredItem();
if (holseredItemId)
{
IEntity *pHolsteredEntity = gEnv->pEntitySystem->GetEntity(holseredItemId);
if (pHolsteredEntity)
{
m_pHostMigrationClientParams->m_pHolsteredItemClass = pHolsteredEntity->GetClass();
}
}*/
IMovementController *pMovementController = pPlayer->GetMovementController();
if(pMovementController)
{
SMovementState movementState;
pMovementController->GetMovementState(movementState);
m_pHostMigrationClientParams->m_aimDirection = movementState.aimDirection;
}
/*CItem *pItem = static_cast<CItem*>(pPlayer->GetCurrentItem());
if (pItem)
{
m_pHostMigrationClientParams->m_pSelectedItemClass = pItem->GetEntity()->GetClass();
CryLog(" currently using item '%s", pItem->GetEntity()->GetName());
}*/
}
else
{
CRY_ASSERT_MESSAGE(false, "Failed to find client actor when initiating a host migration");
gEnv->pNetwork->TerminateHostMigration(hostMigrationInfo.m_session);
return false;
}
}
//.........这里部分代码省略.........