// set the field of view of the camera to enclose the bounding sphere of
// the caster object.
float fRadius = m_spCaster->GetWorldBound().GetRadius(); //获得被观察物体的包围球
float fFOV = fRadius / (kTarget - kTranslate).Length() * 0.95f; //此处由于照相机放置的比较远(沿观察方向5000个单位)
NiFrustum kFrust = m_spCamera->GetViewFrustum();
kFrust.m_fLeft = -fFOV;
kFrust.m_fRight = fFOV;
kFrust.m_fTop = fFOV;
kFrust.m_fBottom = -fFOV;
m_spCamera->SetViewFrustum(kFrust);
本文介绍了一种调整相机视野的方法,使相机能够精确地聚焦于目标物体上。通过计算目标物体包围球的半径,并根据相机与物体之间的距离来设置合适的视野角度。
704

被折叠的 条评论
为什么被折叠?



