当前位置: 首页>>代码示例>>C++>>正文


C++ ISkeletonPose::SetLookIK方法代码示例

本文整理汇总了C++中ISkeletonPose::SetLookIK方法的典型用法代码示例。如果您正苦于以下问题:C++ ISkeletonPose::SetLookIK方法的具体用法?C++ ISkeletonPose::SetLookIK怎么用?C++ ISkeletonPose::SetLookIK使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ISkeletonPose的用法示例。


在下文中一共展示了ISkeletonPose::SetLookIK方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: UpdateLook

void CLookAim_Helper::UpdateLook(CPlayer* pPlayer, ICharacterInstance* pCharacter, bool bEnabled, f32 FOV, const Vec3& targetGlobal,const f32 *customBlends /*= NULL*/)
{
		if (!m_initialized)
		{
				Init(pPlayer, pCharacter);
		}

		bool useLookAtComplex;
		bool useLookAtSimple;

		if (m_canUseLookAtComplex)
		{
				// for now just use the old 'complex' look at method until we sort out how to properly blend old and new look at
				useLookAtComplex = true;
				useLookAtSimple = false;
		}
		else
		{
				useLookAtComplex = true; // for backwards compatibility reasons we still update the old look-at even when m_canUseLookAtComplex is false
				useLookAtSimple = m_canUseLookAtSimple;
		}

		// ---------------------------
		// Complex (old style) Look-At
		// ---------------------------

		ISkeletonPose * pSkeletonPose = pCharacter->GetISkeletonPose();
		pSkeletonPose->SetLookIK(useLookAtComplex && bEnabled, FOV, targetGlobal, customBlends);

		// ---------------------------
		// Simple Head-Only Look-At
		// ---------------------------

		if (m_canUseLookAtSimple)
		{
				float frameTime = gEnv->pTimer->GetFrameTime();

				// Fade In/Out the Weight
				m_lookAtWeight = bEnabled ? CLAMP(m_lookAtWeight + (frameTime * m_lookAtFadeInSpeed), 0.0f, 1.0f) : CLAMP(m_lookAtWeight - (frameTime * m_lookAtFadeOutSpeed), 0.0f, 1.0f);

				// Blend To The Target
				if (targetGlobal.IsValid())
				{
						m_lookAtTargetGlobal = targetGlobal;
				}
				SmoothCD(m_lookAtInterpolatedTargetGlobal, m_lookAtTargetRate, frameTime, m_lookAtTargetGlobal, m_lookAtTargetSmoothTime);

				// Push the LookAtSimple PoseModifier
				if (useLookAtSimple && (m_lookAtWeight > 0.0f))
				{
						m_lookAtSimple->SetTargetGlobal(m_lookAtInterpolatedTargetGlobal);
						m_lookAtSimple->SetWeight(m_lookAtWeight);
						pCharacter->GetISkeletonAnim()->PushLayer(cryinterface_cast<IAnimationPoseModifier>(m_lookAtSimple));
				}
		}
}
开发者ID:AiYong,项目名称:CryGame,代码行数:56,代码来源:LookAim_Helper.cpp


注:本文中的ISkeletonPose::SetLookIK方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。