本文整理汇总了C++中LTRotation::ConvertToMatrix方法的典型用法代码示例。如果您正苦于以下问题:C++ LTRotation::ConvertToMatrix方法的具体用法?C++ LTRotation::ConvertToMatrix怎么用?C++ LTRotation::ConvertToMatrix使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LTRotation
的用法示例。
在下文中一共展示了LTRotation::ConvertToMatrix方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HandleAttachMsg
void WorldModel::HandleAttachMsg( const CParsedMsg &cMsg, const char *szClass )
{
if( cMsg.GetArgCount() >= 2 && !szClass )
{
// Look for the specific objects we want to attach
for( uint i = 1; i < cMsg.GetArgCount( ); i++ )
{
const char *pObjName = cMsg.GetArg(i).c_str();
if( !pObjName )
break;
ObjArray<HOBJECT, 1> objArray;
g_pLTServer->FindNamedObjects( const_cast<char*>(pObjName), objArray );
if( objArray.NumObjects() )
{
AttachObject( objArray.GetObject( 0 ) );
}
}
}
else
{
if( m_vAttachDir.MagSqr() > 1.0f )
{
// Grab an object in the direction of the attach vector and attach it
IntersectQuery IQuery;
IntersectInfo IInfo;
g_pLTServer->GetObjectPos( m_hObject, &IQuery.m_From );
IQuery.m_To = IQuery.m_From + m_vAttachDir;
IQuery.m_Flags = INTERSECT_OBJECTS | IGNORE_NONSOLID;
if( g_pLTServer->IntersectSegment( &IQuery, &IInfo ) )
{
// Only attach objects of a specific class type...
if( IInfo.m_hObject && IsKindOf( IInfo.m_hObject, szClass ))
{
if( m_hAttachDirObj )
DetachObject( m_hAttachDirObj );
m_hAttachDirObj = IInfo.m_hObject;
AttachObject( m_hAttachDirObj );
}
}
}
else
{
LTVector vPos;
LTRotation rRot;
LTMatrix mMat;
g_pLTServer->GetObjectPos( m_hObject, &vPos );
g_pLTServer->GetObjectRotation( m_hObject, &rRot );
rRot.ConvertToMatrix( mMat );
LTVector vMin, vMax, vDims;
g_pPhysicsLT->GetObjectDims( m_hObject, &vDims );
vMin = mMat * (vPos - vDims);
vMax = mMat * (vPos + vDims);
ObjectList *pObjList = g_pLTServer->GetBoxIntersecters( &vMin, &vMax );
if( !pObjList )
return;
HOBJECT hObj;
ObjectLink *pLink = pObjList->m_pFirstLink;
while( pLink )
{
hObj = pLink->m_hObject;
if( hObj && IsKindOf( hObj, szClass ))
{
AttachObject( hObj );
// add it to our list of objects attached via the ATTACH message...
LTObjRefNotifier ref( *this );
ref = hObj;
m_AttachMsgObjList.push_back( ref );
}
pLink = pLink->m_pNext;
}
g_pLTServer->RelinquishList( pObjList );
pObjList = NULL;
}
}
}