本文整理汇总了C++中COperator::GetHitPoint方法的典型用法代码示例。如果您正苦于以下问题:C++ COperator::GetHitPoint方法的具体用法?C++ COperator::GetHitPoint怎么用?C++ COperator::GetHitPoint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类COperator
的用法示例。
在下文中一共展示了COperator::GetHitPoint方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnEvent
void CToolMainPlayer::OnEvent(const CMsg& msg)
{
COperator * pOperator = CMapEditApp::GetInst()->GetOperator();
CTerrainMesh * pTerrainMesh = CMapEditApp::GetInst()->GetEditingMesh();
switch ( msg.msgSource )
{
case MGS_MOUSEMSG:
{
if( msg.msgType.key_type == MGT_MOUSE_LBNDOWN )
{
if ( m_ani != "" && m_ani != "run01" )
{
if( !m_pMainPlayer->SetNextAnimation("run01",FramePair(0,-1),true,200,1.0f) )
{
if( m_pMainPlayer->SetNextAnimation("run01_y",FramePair(0,-1),true,200,1.0f) )
m_ani = "run01_y";
}
else
m_ani = "run01";
}
else
{
m_pMainPlayer->SetNextAnimation("stand01",FramePair(0,-1),true,200,1.0f) ;
}
if ( pTerrainMesh->IsValid(pOperator->GetGridIndexHot()) )
{
m_bStop = false;
m_vEnd = pOperator->GetHitPoint();
//实时更新区域值
CSceneRegionMgr::GetInst()->CalcRegionLightByRegionDistance(m_vEnd);
m_vStart = m_vPos;
m_fRoad = (m_vEnd-m_vStart).Mag();
m_vDir = m_vEnd - m_vPos;
m_vDir.y = 0.0f;
m_vDir.normalize();
m_mat._11 = m_vDir.z;
m_mat._13 = -m_vDir.x;
m_mat._31 = m_vDir.x;
m_mat._33 = m_vDir.z;
}
}
}
break;
}
}
示例2: OnEvent
void CAnimCamera::OnEvent(InputEvent & event)
{
COperator *pOperator = NULL;
pOperator = CMapEditApp::GetInst()->GetOperator();
if ( pOperator == NULL || !m_bActive )
{
return;
}
CVector3f vecVector;
CVector3f hitpoint = pOperator->GetHitPoint();
switch ( event.eType )
{
case EIET_KB_KEYDOWN :
{
// handle keyboard
if ( m_bMovable )
{
// left
if ( event.dwData == DIK_A )
{
vecVector = -m_pCamEx->getRIGHT();
vecVector.y = 0;
vecVector.normalize();
vecVector *= MOVE_SPEED_RATIO;
MoveRTS(vecVector) ;
hitpoint.x += vecVector.x;
hitpoint.z += vecVector.z;
pOperator->SetHitPoint(hitpoint);
m_bResetVS = true;
}
// right
if ( event.dwData == DIK_D )
{
vecVector = m_pCamEx->getRIGHT();
vecVector.y = 0;
vecVector.normalize();
vecVector *= MOVE_SPEED_RATIO;
MoveRTS(vecVector) ;
hitpoint.x += vecVector.x;
hitpoint.z += vecVector.z;
pOperator->SetHitPoint(hitpoint);
m_bResetVS = true;
}
// up
if ( event.dwData == DIK_W )
{
vecVector = m_pCamEx->getDIRECTION();
vecVector.y = 0;
vecVector.normalize();
vecVector *= MOVE_SPEED_RATIO;
MoveRTS(vecVector);
hitpoint.x += vecVector.x;
hitpoint.z += vecVector.z;
pOperator->SetHitPoint(hitpoint);
m_bResetVS = true;
}
// down
if ( event.dwData == DIK_S )
{
vecVector = -m_pCamEx->getDIRECTION();
vecVector.y = 0;
vecVector.normalize();
vecVector *= MOVE_SPEED_RATIO;
MoveRTS(vecVector);
hitpoint.x += vecVector.x;
hitpoint.z += vecVector.z;
pOperator->SetHitPoint(hitpoint);
m_bResetVS = true;
}
// up another type
if ( event.dwData == DIK_Q )
{
vecVector = m_pCamEx->getDIRECTION();
vecVector *= MOVE_SPEED_RATIO;
MoveRTS(vecVector);
hitpoint.x += m_pCamEx->getDIRECTION().x;
hitpoint.y += m_pCamEx->getDIRECTION().y;
pOperator->SetHitPoint(hitpoint);
m_bResetVS = true;
CMapEditApp::GetInst()->GetOperator()->SetGPushed(false);
}
// down another type
if ( event.dwData == DIK_E )
{
vecVector = -m_pCamEx->getDIRECTION();
vecVector *= MOVE_SPEED_RATIO;
MoveRTS(vecVector);
hitpoint.x -= m_pCamEx->getDIRECTION().x;
hitpoint.y -= m_pCamEx->getDIRECTION().y;
pOperator->SetHitPoint(hitpoint);
m_bResetVS = true;
CMapEditApp::GetInst()->GetOperator()->SetGPushed(false);
}
//.........这里部分代码省略.........