本文整理汇总了C++中CClientPed::GetBonePosition方法的典型用法代码示例。如果您正苦于以下问题:C++ CClientPed::GetBonePosition方法的具体用法?C++ CClientPed::GetBonePosition怎么用?C++ CClientPed::GetBonePosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CClientPed
的用法示例。
在下文中一共展示了CClientPed::GetBonePosition方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Fire
void CClientWeapon::Fire ( bool bServerFire )
{
if ( !m_pWeapon || !m_pObject || ( !IsLocalEntity ( ) && m_pOwner != g_pClientGame->GetLocalPlayer ( ) && bServerFire == false ) ) return;
switch ( m_Type )
{
case WEAPONTYPE_PISTOL:
case WEAPONTYPE_PISTOL_SILENCED:
case WEAPONTYPE_DESERT_EAGLE:
#ifdef SHOTGUN_TEST
case WEAPONTYPE_SHOTGUN:
case WEAPONTYPE_SAWNOFF_SHOTGUN:
case WEAPONTYPE_SPAS12_SHOTGUN:
#endif
case WEAPONTYPE_MICRO_UZI:
case WEAPONTYPE_MP5:
case WEAPONTYPE_AK47:
case WEAPONTYPE_M4:
case WEAPONTYPE_TEC9:
case WEAPONTYPE_COUNTRYRIFLE:
case WEAPONTYPE_SNIPERRIFLE:
case WEAPONTYPE_MINIGUN:
{
CMatrix matOrigin;
GetMatrix ( matOrigin );
CVector vecTarget;
float fDistance = m_pWeaponInfo->GetWeaponRange ();
if ( m_targetType == TARGET_TYPE_ENTITY )
{
if ( m_pTarget )
{
if ( m_pTarget->GetType ( ) == CCLIENTPED || m_pTarget->GetType ( ) == CCLIENTPLAYER )
{
CClientPed * pPed = (CClientPed *) (CClientEntity *) m_pTarget;
pPed->GetBonePosition( m_targetBone, vecTarget );
}
else
{
if ( m_pTarget->GetType() == CCLIENTVEHICLE )
{
if ( m_itargetWheel <= MAX_WHEELS )
{
CClientVehicle * pTarget = (CClientVehicle*)(CClientEntity *)m_pTarget;
vecTarget = pTarget->GetGameVehicle()->GetWheelPosition ( (eWheels)m_itargetWheel );
}
else
m_pTarget->GetPosition( vecTarget );
}
else
m_pTarget->GetPosition( vecTarget );
}
if ( m_weaponConfig.bShootIfTargetOutOfRange == false && (matOrigin.GetPosition() - vecTarget).Length() >= fDistance )
{
return;
}
}
else
{
ResetWeaponTarget ( );
}
}
else if ( m_targetType == TARGET_TYPE_VECTOR )
{
vecTarget = m_vecTarget;
if ( m_weaponConfig.bShootIfTargetOutOfRange == false && (matOrigin.GetPosition() - vecTarget).Length() >= fDistance )
{
return;
}
}
else
{
#ifndef SHOTGUN_TEST
CVector vecFireOffset = *m_pWeaponInfo->GetFireOffset ();
matOrigin = CMatrix( vecFireOffset, m_vecFireRotationNoTarget ) * matOrigin;
#endif
CVector vecDirection ( 1, 0, 0 );
vecDirection *= fDistance;
vecTarget = matOrigin.TransformVector( vecDirection );
}
// Save
short sDamage = m_pWeaponInfo->GetDamagePerHit ( );
float fAccuracy = m_pWeaponInfo->GetAccuracy ( );
float fTargetRange = m_pWeaponInfo->GetTargetRange ( );
float fRange = m_pWeaponInfo->GetWeaponRange ( );
// Set new
m_pWeaponInfo->SetDamagePerHit ( m_pWeaponStat->GetDamagePerHit ( ) );
m_pWeaponInfo->SetAccuracy ( m_pWeaponStat->GetAccuracy ( ) );
m_pWeaponInfo->SetTargetRange ( m_pWeaponStat->GetTargetRange ( ) );
m_pWeaponInfo->SetWeaponRange ( m_pWeaponStat->GetWeaponRange ( ) );
#ifdef SHOTGUN_TEST
CVector vecFireOffset = *m_pWeaponInfo->GetFireOffset ();
CMatrix matTemp = CMatrix( vecFireOffset ) * matOrigin;
#ifdef MARKER_DEBUG
// Process
m_pMarker->SetPosition ( matOrigin.GetPosition() );
//.........这里部分代码省略.........
示例2: DoPulse
void CClientWeapon::DoPulse ( void )
{
/*if ( m_bHasTargetDirection )
{
CVector vecDirection = m_vecLastDirection;
CVector vecOffset = m_vecTargetDirection - vecDirection;
vecOffset /= CVector ( 10, 10, 10 );
vecDirection += vecOffset;
vecDirection.Normalize ();
m_vecLastDirection = vecDirection;
SetDirection ( vecDirection );
}*/
if ( m_targetType != TARGET_TYPE_FIXED )
{
CVector vecTargetPos;
if ( m_targetType == TARGET_TYPE_ENTITY )
{
if ( m_pTarget )
{
if ( m_pTarget->GetType ( ) == CCLIENTPED || m_pTarget->GetType ( ) == CCLIENTPLAYER )
{
CClientPed * pPed = (CClientPed *) (CClientEntity *)(m_pTarget);
pPed->GetBonePosition( m_targetBone, vecTargetPos );
}
else
{
m_pTarget->GetPosition( vecTargetPos );
}
}
else
{
ResetWeaponTarget ( );
}
}
else if ( m_targetType == TARGET_TYPE_VECTOR )
{
vecTargetPos = m_vecTarget;
}
if ( !m_pAttachedToEntity )
{
// Calculate direction to target
CVector vecPosition;
GetPosition ( vecPosition );
CVector vecDirection = vecTargetPos - vecPosition;
// Convert direction to rotation
CVector vecRotation = vecDirection.ToRotation ();
SetRotationRadians ( vecRotation );
}
else
{
// Transform target position into local (AttachedToEntity) space
CMatrix attachedToMatrix;
m_pAttachedToEntity->GetMatrix ( attachedToMatrix );
CVector vecLocalTargetPos = attachedToMatrix.Inverse ().TransformVector ( vecTargetPos );
// Calculate local direction
CVector vecDirection = vecLocalTargetPos - m_vecAttachedPosition;
// Convert local direction to local rotation
CVector vecRotation = vecDirection.ToRotation ();
// Apply local rotation
SetAttachedOffsets ( m_vecAttachedPosition, vecRotation );
}
}
if ( m_nAmmoInClip <= 0 )
{
if ( m_weaponConfig.bInstantReload == false )
{
if ( m_nAmmoTotal >= m_pWeaponStat->GetMaximumClipAmmo() && m_State != WEAPONSTATE_RELOADING )
{
m_PreviousState = m_State;
m_State = WEAPONSTATE_RELOADING;
m_reloadTimer.Reset();
}
else if ( m_State == WEAPONSTATE_RELOADING && m_reloadTimer.Get() >= m_pWeapon->GetWeaponReloadTime ( m_pWeaponStat ) )
{
m_State = m_PreviousState;
m_nAmmoInClip = m_pWeaponStat->GetMaximumClipAmmo();
m_nAmmoTotal -= m_pWeaponStat->GetMaximumClipAmmo();
}
else
return;
}
else
{
if ( m_nAmmoTotal >= m_pWeaponStat->GetMaximumClipAmmo() && m_State != WEAPONSTATE_RELOADING )
{
m_nAmmoInClip = m_pWeaponStat->GetMaximumClipAmmo();
m_nAmmoTotal -= m_pWeaponStat->GetMaximumClipAmmo();
}
}
}
if ( m_nAmmoInClip > 0 && ( IsLocalEntity ( ) || m_pOwner == g_pClientGame->GetLocalPlayer ( ) ) )
{
if ( m_State == WEAPONSTATE_FIRING && m_fireTimer.Get() >= m_iWeaponFireRate )
//.........这里部分代码省略.........
示例3: Fire
void CClientWeapon::Fire ( void )
{
if ( !m_pWeapon || !m_pObject ) return;
switch ( m_Type )
{
case WEAPONTYPE_PISTOL:
case WEAPONTYPE_PISTOL_SILENCED:
case WEAPONTYPE_DESERT_EAGLE:
#ifdef SHOTGUN_TEST
case WEAPONTYPE_SHOTGUN:
case WEAPONTYPE_SAWNOFF_SHOTGUN:
case WEAPONTYPE_SPAS12_SHOTGUN:
#endif
case WEAPONTYPE_MICRO_UZI:
case WEAPONTYPE_MP5:
case WEAPONTYPE_AK47:
case WEAPONTYPE_M4:
case WEAPONTYPE_TEC9:
case WEAPONTYPE_COUNTRYRIFLE:
case WEAPONTYPE_SNIPERRIFLE:
case WEAPONTYPE_MINIGUN:
{
CVector vecOrigin, vecRotation;
GetPosition ( vecOrigin );
if ( m_pAttachedToEntity )
{
GetRotationRadians ( vecRotation );
}
else
{
GetRotationRadians ( vecRotation );
vecRotation = -vecRotation;
}
CVector vecTarget;
float fDistance = m_pWeaponInfo->GetWeaponRange ();
if ( m_targetType == TARGET_TYPE_ENTITY )
{
if ( m_pTarget )
{
if ( m_pTarget->GetType ( ) == CCLIENTPED || m_pTarget->GetType ( ) == CCLIENTPLAYER )
{
CClientPed * pPed = (CClientPed *) (CClientEntity *) m_pTarget;
pPed->GetBonePosition( m_targetBone, vecTarget );
}
else
{
if ( m_pTarget->GetType() == CCLIENTVEHICLE )
{
if ( m_itargetWheel <= MAX_WHEELS )
{
CClientVehicle * pTarget = (CClientVehicle*)(CClientEntity *)m_pTarget;
vecTarget = pTarget->GetGameVehicle()->GetWheelPosition ( (eWheels)m_itargetWheel );
}
else
m_pTarget->GetPosition( vecTarget );
}
else
m_pTarget->GetPosition( vecTarget );
}
if ( m_weaponConfig.bShootIfTargetOutOfRange == false && (vecOrigin - vecTarget).Length() >= fDistance )
{
return;
}
}
else
{
ResetWeaponTarget ( );
}
}
else if ( m_targetType == TARGET_TYPE_VECTOR )
{
vecTarget = m_vecTarget;
if ( m_weaponConfig.bShootIfTargetOutOfRange == false && (vecOrigin - vecTarget).Length() >= fDistance )
{
return;
}
}
else
{
CVector vecFireOffset = *m_pWeaponInfo->GetFireOffset ();
RotateVector ( vecFireOffset, vecRotation );
#ifndef SHOTGUN_TEST
vecOrigin += vecFireOffset;
#endif
CVector vecDirection ( 1, 0, 0 );
vecDirection *= fDistance;
RotateVector ( vecDirection, vecRotation );
vecTarget = vecOrigin + vecDirection;
}
// Save
short sDamage = m_pWeaponInfo->GetDamagePerHit ( );
float fAccuracy = m_pWeaponInfo->GetAccuracy ( );
float fTargetRange = m_pWeaponInfo->GetTargetRange ( );
//.........这里部分代码省略.........