本文整理汇总了C++中C_BaseAnimating::InitAsClientRagdoll方法的典型用法代码示例。如果您正苦于以下问题:C++ C_BaseAnimating::InitAsClientRagdoll方法的具体用法?C++ C_BaseAnimating::InitAsClientRagdoll怎么用?C++ C_BaseAnimating::InitAsClientRagdoll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类C_BaseAnimating
的用法示例。
在下文中一共展示了C_BaseAnimating::InitAsClientRagdoll方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ImpactTrace
//.........这里部分代码省略.........
// don't do cutting if we cut this joint in the past
// or if this joint is our current branch root
if ( iSplitboneIndex < 0
|| m_jointBones.IsBitSet( iSplitboneIndex )
|| m_iBranchRootBone == iSplitboneIndex )
return;
matrix3x4_t boneDelta0[MAXSTUDIOBONES];
matrix3x4_t boneDelta1[MAXSTUDIOBONES];
matrix3x4_t currentBones[MAXSTUDIOBONES];
const float boneDt = 0.1f;
// setup bones without shrinking to position the new gibs
SetShrinkingEnabled( false );
GetRagdollInitBoneArrays( boneDelta0, boneDelta1, currentBones, boneDt );
SetShrinkingEnabled( true );
InvalidateBoneCache();
// create the new gibmodels
FOR_EACH_VEC( gibModels, i )
{
ragdollparams_partial_t &partial = gibModels[ i ];
// add old trunk joints
for ( int iBit = m_jointBones.FindNextSetBit( 0 );
iBit >= 0; iBit = m_jointBones.FindNextSetBit( iBit + 1 ) )
{
if ( m_iBranchRootBone == iBit )
continue;
const char *pszName = pHdr->pBone( iBit )->pszName();
partial.trunkBones.AddToTail( pszName );
}
// if we create a trunk from an existing branch
// we have to propagate the branch root bone
if ( partial.rootBone.IsEmpty()
&& m_iBranchRootBone >= 0 )
{
partial.rootBone = pHdr->pBone( m_iBranchRootBone )->pszName();
}
C_BaseAnimating *pGib = CreateRagdollCopy( false );
C_ClientPartialRagdoll *pRecursiveRagdoll = dynamic_cast< C_ClientPartialRagdoll* >( pGib );
Assert( pRecursiveRagdoll );
// apply force and propagate cut information
if ( pRecursiveRagdoll != NULL )
{
pRecursiveRagdoll->SetRecursiveGibData( STRING( m_strRecursiveParent ), STRING( m_strRecursiveGoreName ),
STRING( m_strRecursiveGoreMaterialName ) );
pRecursiveRagdoll->SetShrinkingEnabled( true );
Vector vecDelta = pTrace->endpos - pTrace->startpos;
if ( vecDelta.LengthSqr() <= FLT_EPSILON )
{
vecDelta = RandomVector( -1, 1 );
}
vecDelta.NormalizeInPlace();
pRecursiveRagdoll->m_vecForce = vecDelta * RandomFloat( 15000.0f, 35000.0f );
pRecursiveRagdoll->m_nForceBone = pTrace->physicsbone;
pRecursiveRagdoll->SetBloodColor( BloodColor() );
pRecursiveRagdoll->m_jointBones.Or( m_jointBones, &pRecursiveRagdoll->m_jointBones );
//FOR_EACH_VEC( m_Gore, i )
//{
// const int iBone = m_Gore[ i ].m_iBone;
// if ( iBone >= 0 && iBone == m_iBranchRootBone )
// {
// }
// pRecursiveRagdoll->m_Gore.AddToTail( m_Gore[ i ] );
// m_Gore.Remove( i );
// i--;
//}
}
pGib->InitAsClientRagdoll( boneDelta0, boneDelta1, currentBones, boneDt, false, &partial );
if ( bExplosionImpact
&& RandomFloat() <= gstring_gibbing_explosion_recursive_chance.GetFloat() / 100.0f )
{
pGib->ImpactTrace( pTrace, iDamageType, pCustomImpactName );
}
if ( BloodColor() == BLOOD_COLOR_RED
&& ( !pRecursiveRagdoll || !pRecursiveRagdoll->m_bReleaseRagdoll )
&& ShouldCreateBloodParticles() )
{
Assert( pszParentSplitBone != NULL );
DispatchGibParticle( pGib, pszParentSplitBone, bExplosionImpact, BloodColor() );
}
}