本文整理汇总了C++中CActor::GetAnimationGraphState方法的典型用法代码示例。如果您正苦于以下问题:C++ CActor::GetAnimationGraphState方法的具体用法?C++ CActor::GetAnimationGraphState怎么用?C++ CActor::GetAnimationGraphState使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CActor
的用法示例。
在下文中一共展示了CActor::GetAnimationGraphState方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetCurrentAnimationState
//------------------------------------------------------------------------
int CScriptBind_Actor::GetCurrentAnimationState(IFunctionHandler *pH)
{
CActor *pActor = GetActor(pH);
if (!pActor)
return pH->EndFunction();
const char * value = "<no state>";
if (IAnimationGraphState * pState = pActor->GetAnimationGraphState())
value = pState->GetCurrentStateName();
return pH->EndFunction(value);
}
示例2: UpdateMounted
//.........这里部分代码省略.........
const float maxRotSpeed = 2.0f;
float maxAngle = frameTime * maxRotSpeed;
if(fabs(reqAngle) > maxAngle)
{
Vec3 axis = currentDir.Cross(dir);
if(axis.GetLengthSquared()>0.001f) // current dir and new dir are enough different
dir = currentDir.GetRotated(axis.GetNormalized(),sgn(reqAngle)*maxAngle);
}
}
//adjust the orientation of the gun based on the aim-direction
tm = Matrix33::CreateRotationVDir(dir);
Vec3 vWPos=GetEntity()->GetWorldPos();
tm.SetTranslation(vWPos);
GetEntity()->SetWorldTM(tm); //set the new orientation of the mounted gun
vGunXAxis=tm.GetColumn0();
Vec3 vInitialAimDirection = m_stats.mount_dir;
Matrix33 vInitialPlayerOrientation = Matrix33::CreateRotationVDir(vInitialAimDirection);
assert( vInitialAimDirection.IsUnit() );
Vec3 newp;
if (pActor->IsThirdPerson())
{
//third person
f32 dist = m_mountparams.body_distance*1.3f;
Vec3 oldp = pActor->GetEntity()->GetWorldPos();
newp = GetEntity()->GetWorldPos()-vInitialAimDirection*dist; //mounted gun
newp.z = oldp.z;
}
else
{
//first person
f32 fMoveBack = (1.0f+(dir.z*dir.z*dir.z*dir.z*4.0f))*0.75f;
f32 dist = m_mountparams.eye_distance*fMoveBack;
Vec3 oldp = pActor->GetEntity()->GetWorldPos();
newp = GetEntity()->GetWorldPos()-dir*dist; //mounted gun
//newp.z -= 0.75f;
newp.z = oldp.z;
}
Matrix34 actortm(pActor->GetEntity()->GetWorldTM());
//if (pActor->IsThirdPerson())
actortm=vInitialPlayerOrientation;
actortm.SetTranslation(newp);
pActor->GetEntity()->SetWorldTM(actortm, ENTITY_XFORM_USER);
pActor->GetAnimationGraphState()->SetInput("Action","gunnerMounted");
//f32 g_YLine=80.0f;
//gEnv->pRenderer->Draw2dLabel( 1,g_YLine, 1.3f, fColor, false, "Mounted Gun Active for FP and AI" );
if (ICharacterInstance *pCharacter = pActor->GetEntity()->GetCharacter(0))
{
ISkeletonAnim *pSkeletonAnim = pCharacter->GetISkeletonAnim();
assert(pSkeletonAnim);
uint32 numAnimsLayer = pSkeletonAnim->GetNumAnimsInFIFO(0);
for(uint32 i=0; i<numAnimsLayer; i++)
{
CAnimation &animation = pSkeletonAnim->GetAnimFromFIFO(0, i);
if (animation.m_AnimParams.m_nFlags & CA_MANUAL_UPDATE)
{
f32 aimrad = Ang3::CreateRadZ(Vec2(vInitialAimDirection),Vec2(dir));
animation.m_fAnimTime = clamp_tpl(aimrad/gf_PI,-1.0f,+1.0f)*0.5f+0.5f;
//if (pActor->IsThirdPerson()==0)
//animation.m_fAnimTime=0.6f; //Ivo & Benito: high advanced future code. don't ask what it is
//Benito - Not needed any more ;)
//f32 g_YLine=100.0f;
//gEnv->pRenderer->Draw2dLabel( 1,g_YLine, 1.3f, fColor, false, "AnimTime: %f MyAimAngle: %f deg:% distance:%f", animation.m_fAnimTime, aimrad, RAD2DEG(aimrad),m_mountparams.body_distance );
}
}
}
m_stats.mount_last_aimdir = dir;
}
}
if (ICharacterInstance* pCharInstance = pActor->GetEntity()->GetCharacter(0))
{
if (ISkeletonAnim* pSkeletonAnim = pCharInstance->GetISkeletonAnim())
{
OldBlendSpace ap;
if (GetAimBlending(ap))
{
pSkeletonAnim->SetBlendSpaceOverride(eMotionParamID_TurnSpeed, 0.5f + 0.5f * ap.m_turn, true);
}
}
}
UpdateIKMounted(pActor, vGunXAxis*0.1f);
RequireUpdate(eIUS_General);
}
}