本文整理汇总了C++中IActor::GetMovementController方法的典型用法代码示例。如果您正苦于以下问题:C++ IActor::GetMovementController方法的具体用法?C++ IActor::GetMovementController怎么用?C++ IActor::GetMovementController使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IActor
的用法示例。
在下文中一共展示了IActor::GetMovementController方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GotoTagPoint
void CDevMode::GotoTagPoint( int i )
{
std::vector<STagFileEntry> tags = LoadTagFile();
if (tags.size() > size_t(i))
{
STagFileEntry ent = tags[i];
IActor * pActor = CCryAction::GetCryAction()->GetClientActor();
if (!pActor) return;
IEntity * pEntity = pActor->GetEntity();
Quat rot;
Vec3 pos = ent.pos;
// pos loaded is a camera position, we must convert it into the player position.
if (IMovementController * pMC = pActor->GetMovementController())
{
SMovementState ms;
pMC->GetMovementState(ms);
pos -= (ms.eyePosition-ms.pos);
}
rot.SetRotationXYZ( ent.ang );
Vec3 scale = pEntity->GetScale();
pEntity->SetPosRotScale( pos, rot, scale );
pActor->SetViewRotation( rot );
}
}
开发者ID:NightOwlsEntertainment,项目名称:PetBox_A_Journey_to_Conquer_Elementary_Algebra,代码行数:27,代码来源:DevMode.cpp
示例2: RefreshAnimTarget
void CAnimatedCharacter::RefreshAnimTarget()
{
if (m_pMannequinAGState)
{
IActorSystem* pActorSystem = CCryAction::GetCryAction()->GetIActorSystem();
assert(pActorSystem != NULL);
IActor* pActor = pActorSystem->GetActor(GetEntity()->GetId());
IMovementController* pMovementController = pActor->GetMovementController();
m_pAnimTarget = pMovementController->GetExactPositioningTarget();
}
}
示例3: Update
//------------------------------------------------------------------------
void CTracerManager::Update(float frameTime)
{
IActor *pActor = g_pGame->GetIGameFramework()->GetClientActor();
if (!pActor)
{
return;
}
if (!pActor->GetMovementController())
{
return;
}
SMovementState state;
pActor->GetMovementController()->GetMovementState(state);
m_actives.swap(m_updating);
TTracerIdVector::iterator it, end = m_updating.end();
for (it = m_updating.begin(); it != end; ++it)
{
CTracer *tracer = m_pool[*it];
if (tracer->Update(frameTime, state.eyePosition))
{
m_actives.push_back(*it);
}
else
{
if (IEntity *pEntity = gEnv->pEntitySystem->GetEntity(tracer->m_entityId))
{
pEntity->Hide(1);
pEntity->SetWorldTM(Matrix34::CreateIdentity());
}
}
}
m_updating.resize(0);
}
示例4: SpawnScreenExplosionEffect
//--------------------------------------------------------------------------------------------------
// Name: SpawnScreenExplosionEffect
// Desc: Spawns screen explosion effect
//--------------------------------------------------------------------------------------------------
void CExplosionGameEffect::SpawnScreenExplosionEffect(const SExplosionContainer &explosionContainer)
{
// Disclaimer: this code was originally from GameRulesClientServer::ProcessClientExplosionScreenFX()
const ExplosionInfo& explosionInfo = explosionContainer.m_explosionInfo;
if(explosionInfo.pressure < 1.0f)
return;
IActor *pClientActor = g_pGame->GetIGameFramework()->GetClientActor();
if(pClientActor != NULL && !pClientActor->IsDead())
{
CPlayer* pPlayer = static_cast<CPlayer*>(pClientActor);
bool hasFlashBangEffect = explosionInfo.blindAmount > 0.0f;
// Flashbang friends and self?...
if(hasFlashBangEffect)
{
bool flashBangSelf = true;
bool flashBangFriends = false;
#ifndef _RELEASE
flashBangSelf = g_pGameCVars->g_flashBangSelf != 0;
flashBangFriends = g_pGameCVars->g_flashBangFriends != 0;
#endif
bool ownFlashBang = pPlayer->GetEntityId() == explosionInfo.shooterId;
if((!flashBangSelf && ownFlashBang) || // FlashBang self?
((g_pGame->GetGameRules()->GetFriendlyFireRatio()<=0.0f) && (!flashBangFriends) && (!ownFlashBang) && pPlayer->IsFriendlyEntity(explosionInfo.shooterId))) // FlashBang friends?
{
return;
}
}
// Distance
float dist = (pClientActor->GetEntity()->GetWorldPos() - explosionInfo.pos).len();
// Is the explosion in Player's FOV (let's suppose the FOV a bit higher, like 80)
SMovementState state;
if(IMovementController *pMV = pClientActor->GetMovementController())
{
pMV->GetMovementState(state);
}
Vec3 eyeToExplosion = explosionInfo.pos - state.eyePosition;
Vec3 eyeDir = pClientActor->GetLinkedVehicle() ? pPlayer->GetVehicleViewDir() : state.eyeDirection;
eyeToExplosion.Normalize();
float eyeDirectionDP = eyeDir.Dot(eyeToExplosion);
bool inFOV = (eyeDirectionDP > 0.68f);
// All explosions have radial blur (default 30m radius)
const float maxBlurDistance = (explosionInfo.maxblurdistance >0.0f) ? explosionInfo.maxblurdistance : 30.0f;
if((maxBlurDistance > 0.0f) && (g_pGameCVars->g_radialBlur > 0.0f) && (explosionInfo.radius > 0.5f))
{
if (inFOV && (dist < maxBlurDistance))
{
const int intersectionObjTypes = ent_static | ent_terrain;
const unsigned int intersectionFlags = rwi_stop_at_pierceable|rwi_colltype_any;
m_deferredScreenEffects.RequestRayCast(CDeferredExplosionEffect::eDET_RadialBlur,
explosionInfo.pos, -eyeToExplosion, dist, maxBlurDistance, intersectionObjTypes, intersectionFlags, NULL, 0);
}
}
// Flashbang effect
if(hasFlashBangEffect && ((dist < (explosionInfo.radius*g_pGameCVars->g_flashBangNotInFOVRadiusFraction))
|| (inFOV && (dist < explosionInfo.radius))))
{
ray_hit hit;
const int intersectionObjTypes = ent_static | ent_terrain;
const unsigned int intersectionFlags = rwi_stop_at_pierceable|rwi_colltype_any;
const int intersectionMaxHits = 1;
int collision = gEnv->pPhysicalWorld->RayWorldIntersection( explosionInfo.pos,
-eyeToExplosion*dist,
intersectionObjTypes,
intersectionFlags,
&hit,
intersectionMaxHits);
// If there was no obstacle between flashbang grenade and player
if(!collision)
{
bool enabled = true;
if(enabled)
{
CCCPOINT (FlashBang_Explode_BlindLocalPlayer);
float timeScale = max(0.0f, 1 - (dist/explosionInfo.radius));
float lookingAt = max(g_pGameCVars->g_flashBangMinFOVMultiplier, (eyeDirectionDP + 1)*0.5f);
float time = explosionInfo.flashbangScale * timeScale *lookingAt; // time is determined by distance to explosion
CRY_ASSERT_MESSAGE(pClientActor->IsPlayer(),"Effect shouldn't be spawned if not a player");
SPlayerStats* pStats = static_cast<SPlayerStats*>(pPlayer->GetActorStats());
NET_BATTLECHATTER(BC_Blinded, pPlayer);
//.........这里部分代码省略.........
示例5: 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;
}
}
//.........这里部分代码省略.........