本文整理汇总了C++中C_BaseAnimating::HitboxToWorldTransforms方法的典型用法代码示例。如果您正苦于以下问题:C++ C_BaseAnimating::HitboxToWorldTransforms方法的具体用法?C++ C_BaseAnimating::HitboxToWorldTransforms怎么用?C++ C_BaseAnimating::HitboxToWorldTransforms使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类C_BaseAnimating
的用法示例。
在下文中一共展示了C_BaseAnimating::HitboxToWorldTransforms方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetRandomPointsOnControllingObjectHitBox
void CParticleSystemQuery::GetRandomPointsOnControllingObjectHitBox(
CParticleCollection *pParticles,
int nControlPointNumber,
int nNumPtsOut,
float flBBoxScale,
int nNumTrysToGetAPointInsideTheModel,
Vector *pPntsOut,
Vector vecDirectionalBias,
Vector *pHitBoxRelativeCoordOut,
int *pHitBoxIndexOut
)
{
bool bSucesss = false;
#ifndef GAME_DLL
EHANDLE *phMoveParent = reinterpret_cast<EHANDLE *> ( pParticles->m_ControlPoints[nControlPointNumber].m_pObject );
CBaseEntity *pMoveParent = NULL;
if ( phMoveParent )
{
pMoveParent = *( phMoveParent );
}
if ( pMoveParent )
{
float flRandMax = flBBoxScale;
float flRandMin = 1.0 - flBBoxScale;
Vector vecBasePos;
pParticles->GetControlPointAtTime( nControlPointNumber, pParticles->m_flCurTime, &vecBasePos );
s_BoneMutex.Lock();
C_BaseAnimating *pAnimating = pMoveParent->GetBaseAnimating();
if ( pAnimating )
{
matrix3x4_t *hitboxbones[MAXSTUDIOBONES];
if ( pAnimating->HitboxToWorldTransforms( hitboxbones ) )
{
studiohdr_t *pStudioHdr = modelinfo->GetStudiomodel( pAnimating->GetModel() );
if ( pStudioHdr )
{
mstudiohitboxset_t *set = pStudioHdr->pHitboxSet( pAnimating->GetHitboxSet() );
if ( set )
{
bSucesss = true;
Vector vecWorldPosition;
float u = 0, v = 0, w = 0;
int nHitbox = 0;
int nNumIters = nNumTrysToGetAPointInsideTheModel;
if (! vecDirectionalBias.IsZero( 0.0001 ) )
nNumIters = MAX( nNumIters, 5 );
for( int i=0 ; i < nNumPtsOut; i++)
{
int nTryCnt = nNumIters;
float flBestPointGoodness = -1.0e20;
do
{
int nTryHitbox = pParticles->RandomInt( 0, set->numhitboxes - 1 );
mstudiobbox_t *pBox = set->pHitbox(nTryHitbox);
float flTryU = pParticles->RandomFloat( flRandMin, flRandMax );
float flTryV = pParticles->RandomFloat( flRandMin, flRandMax );
float flTryW = pParticles->RandomFloat( flRandMin, flRandMax );
Vector vecLocalPosition;
vecLocalPosition.x = GetSurfaceCoord( flTryU, pBox->bbmin.x * pAnimating->GetModelScale(), pBox->bbmax.x * pAnimating->GetModelScale() );
vecLocalPosition.y = GetSurfaceCoord( flTryV, pBox->bbmin.y * pAnimating->GetModelScale(), pBox->bbmax.y * pAnimating->GetModelScale() );
vecLocalPosition.z = GetSurfaceCoord( flTryW, pBox->bbmin.z * pAnimating->GetModelScale(), pBox->bbmax.z * pAnimating->GetModelScale() );
Vector vecTryWorldPosition;
VectorTransform( vecLocalPosition, *hitboxbones[pBox->bone], vecTryWorldPosition );
float flPointGoodness = pParticles->RandomFloat( 0, 72 )
+ DotProduct( vecTryWorldPosition - vecBasePos,
vecDirectionalBias );
if ( nNumTrysToGetAPointInsideTheModel )
{
// do a point in solid test
Ray_t ray;
trace_t tr;
ray.Init( vecTryWorldPosition, vecTryWorldPosition );
enginetrace->ClipRayToEntity( ray, MASK_ALL, pMoveParent, &tr );
if ( tr.startsolid )
flPointGoodness += 1000.; // got a point inside!
}
if ( flPointGoodness > flBestPointGoodness )
{
u = flTryU;
v = flTryV;
w = flTryW;
//.........这里部分代码省略.........