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


C++ VisBaseEntity_cl::SetRotationMatrix方法代码示例

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


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

示例1: PerFrameUpdate

void VLineFollowerComponent::PerFrameUpdate()
{
  VisBaseEntity_cl* pOwner = (VisBaseEntity_cl *)GetOwner();
  if (!pOwner || !m_pFollowPath)
    return;
    
  hkvVec3 vPos;
  hkvVec3 vDir;
  m_pFollowPath->EvalPoint(m_fCurrentPathPos, vPos, &vDir);
  vPos.z = pOwner->GetPosition().z;
  float fDiff  = Vision::GetTimer()->GetTimeDifference();

  if((vPos - pOwner->GetPosition()).getLength() < Path_TriggerDistance)
  {
    if(fDiff>0.1) 
      m_fCurrentPathPos += (3/Path_NumberSteps);
    else
      m_fCurrentPathPos += (1/Path_NumberSteps);

    if (m_fCurrentPathPos>1.f)
    {
      if (m_pFollowPath->IsClosed())
        m_fCurrentPathPos = hkvMath::mod (m_fCurrentPathPos,1.f);
      else
        m_fCurrentPathPos = 1.f;
    }

    m_pFollowPath->EvalPoint(m_fCurrentPathPos, vPos, &vDir);
    vPos.z = pOwner->GetPosition().z;
    if(Vision::Editor.IsAnimatingOrPlaying() && Debug_DisplayBoxes) 
      Vision::Game.DrawCube(vPos,80.f);
  } 
  else
  {
    if(Vision::Editor.IsAnimatingOrPlaying() && Debug_DisplayBoxes) 
      Vision::Game.DrawCube(vPos,80.f,V_RGBA_YELLOW);
  }

  // Orient the entity in the right direction
  hkvMat3 mRot(hkvNoInitialization);
  mRot.setLookInDirectionMatrix (vPos - pOwner->GetPosition());

  mRot = mRot.multiply (m_mDeltaRotation);
  pOwner->SetRotationMatrix(mRot);
  
  // The animation we are playing should have motion delta which will 
  // move towards the target position. No animation, well lets add at
  // least some motion delta
  if (!m_bPlayingAnim) 
  {
    pOwner->SetMotionDeltaLocalSpace( hkvVec3(1.f,0.f,0.f)*(Model_CapsuleRadius*fDiff) );
  }
}
开发者ID:Alagong,项目名称:projectanarchy,代码行数:53,代码来源:VLineFollowerComponent.cpp


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