本文整理汇总了C++中CActor::GetLocalEyePos2方法的典型用法代码示例。如果您正苦于以下问题:C++ CActor::GetLocalEyePos2方法的具体用法?C++ CActor::GetLocalEyePos2怎么用?C++ CActor::GetLocalEyePos2使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CActor
的用法示例。
在下文中一共展示了CActor::GetLocalEyePos2方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: vOffset
void CUIHUD3D::UpdateView(const SViewParams &viewParams)
{
CActor* pLocalPlayer = (CActor*)g_pGame->GetIGameFramework()->GetClientActor();
if (gEnv->IsEditor() && !gEnv->IsEditing() && !m_pHUDRootEntity)
SpawnHudEntities();
if (m_pHUDRootEntity && pLocalPlayer)
{
Vec3 position = viewParams.position;
const Vec3 viewDir = viewParams.rotation.GetColumn1();
Vec3 vOffset(0,0,0);
if (!pLocalPlayer->IsDead() && pLocalPlayer->GetLinkedVehicle() == NULL)
{
const Vec3 eyePos = pLocalPlayer->GetLocalEyePos2();
const Vec3 cameraXAxis = viewParams.rotation.GetColumn0();
const float difZ = (eyePos.z - 1.68f) * 0.4f;
const float difX = (eyePos.x - 0.12f) * 0.15f;
vOffset += cameraXAxis * difX;
vOffset += Vec3(0, 0, difZ);
}
const float distance = g_pGameCVars->g_hud3D_cameraOverride ? g_pGameCVars->g_hud3d_cameraDistance : m_fHudDist;
const float offset = g_pGameCVars->g_hud3D_cameraOverride ? g_pGameCVars->g_hud3d_cameraOffsetZ : m_fHudZOffset;
vOffset += Vec3(0, 0, offset);
position += vOffset;
position += viewDir * distance;
static const Quat rot90Deg = Quat::CreateRotationXYZ( Ang3(gf_PI * 0.5f, 0, 0) );
const Quat rotation = viewParams.rotation * rot90Deg; // rotate 90 degrees around X-Axis
m_pHUDRootEntity->SetPos(position);
m_pHUDRootEntity->SetRotation(rotation);
}
}