本文整理汇总了C++中CStudioHdr::GetVirtualModel方法的典型用法代码示例。如果您正苦于以下问题:C++ CStudioHdr::GetVirtualModel方法的具体用法?C++ CStudioHdr::GetVirtualModel怎么用?C++ CStudioHdr::GetVirtualModel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CStudioHdr
的用法示例。
在下文中一共展示了CStudioHdr::GetVirtualModel方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateRagdoll
void C_CFRagdoll::CreateRagdoll()
{
// First, initialize all our data. If we have the player's entity on our client,
// then we can make ourselves start out exactly where the player is.
C_CFPlayer *pPlayer = dynamic_cast< C_CFPlayer* >( m_hPlayer.Get() );
if ( pPlayer && !pPlayer->IsDormant() )
{
// move my current model instance to the ragdoll's so decals are preserved.
pPlayer->SnatchModelInstance( this );
VarMapping_t *varMap = GetVarMapping();
// Copy all the interpolated vars from the player entity.
// The entity uses the interpolated history to get bone velocity.
bool bRemotePlayer = (pPlayer != C_BasePlayer::GetLocalPlayer());
if ( bRemotePlayer )
{
Interp_Copy( pPlayer );
SetAbsAngles( pPlayer->GetRenderAngles() );
GetRotationInterpolator().Reset();
m_flAnimTime = pPlayer->m_flAnimTime;
SetSequence( pPlayer->GetSequence() );
m_flPlaybackRate = pPlayer->GetPlaybackRate();
}
else
{
// This is the local player, so set them in a default
// pose and slam their velocity, angles and origin
SetAbsOrigin( m_vecRagdollOrigin );
SetAbsAngles( pPlayer->GetRenderAngles() );
SetAbsVelocity( m_vecRagdollVelocity );
int iSeq = LookupSequence( "idle" );
if ( iSeq == -1 )
{
Assert( false ); // missing walk_lower?
iSeq = 0;
}
SetSequence( iSeq ); // walk_lower, basic pose
SetCycle( 0.0 );
Interp_Reset( varMap );
}
}
else
{
// overwrite network origin so later interpolation will
// use this position
SetNetworkOrigin( m_vecRagdollOrigin );
SetAbsOrigin( m_vecRagdollOrigin );
SetAbsVelocity( m_vecRagdollVelocity );
Interp_Reset( GetVarMapping() );
}
if (pPlayer)
{
SetModelIndex( m_nModelIndex );
m_nSkin = pPlayer->m_nSkin;
SetBodygroup(1, pPlayer->m_bIsDecapitated);
}
// Turn it into a ragdoll.
if ( cl_ragdoll_physics_enable.GetBool() )
{
// Make us a ragdoll..
m_nRenderFX = kRenderFxRagdoll;
matrix3x4_t boneDelta0[MAXSTUDIOBONES];
matrix3x4_t boneDelta1[MAXSTUDIOBONES];
matrix3x4_t currentBones[MAXSTUDIOBONES];
const float boneDt = 0.05f;
// We have to make sure that we're initting this client ragdoll off of the same model.
// GetRagdollInitBoneArrays uses the *player* Hdr, which may be a different model than
// the ragdoll Hdr, if we try to create a ragdoll in the same frame that the player
// changes their player model.
CStudioHdr *pRagdollHdr = GetModelPtr();
CStudioHdr *pPlayerHdr = NULL;
if ( pPlayer )
pPlayerHdr = pPlayer->GetModelPtr();
bool bChangedModel = false;
if ( pRagdollHdr && pPlayerHdr )
{
bChangedModel = pRagdollHdr->GetVirtualModel() != pPlayerHdr->GetVirtualModel();
Assert( !bChangedModel && "C_CFRagdoll::CreateRagdoll: Trying to create ragdoll with a different model than the player it's based on" );
}
if ( pPlayer && !pPlayer->IsDormant() && !bChangedModel && pPlayerHdr )
//.........这里部分代码省略.........