本文整理汇总了C++中SetBoneController函数的典型用法代码示例。如果您正苦于以下问题:C++ SetBoneController函数的具体用法?C++ SetBoneController怎么用?C++ SetBoneController使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SetBoneController函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: switch
void CNPC_GMan::RunTask( const Task_t *pTask )
{
switch( pTask->iTask )
{
case TASK_WAIT:
// look at who I'm talking to
if (m_flTalkTime > gpGlobals->curtime && m_hTalkTarget != NULL)
{
AddLookTarget( m_hTalkTarget->GetAbsOrigin(), 1.0, 2.0 );
}
// look at player, but only if playing a "safe" idle animation
else if (m_hPlayer != NULL && (GetSequence() == 0 || IsInC5A1()) )
{
AddLookTarget( m_hPlayer->EyePosition(), 1.0, 3.0 );
}
else
{
// Just center the head forward.
Vector forward;
GetVectors( &forward, NULL, NULL );
AddLookTarget( GetAbsOrigin() + forward * 12.0f, 1.0, 1.0 );
SetBoneController( 0, 0 );
}
BaseClass::RunTask( pTask );
break;
}
SetBoneController( 0, 0 );
BaseClass::RunTask( pTask );
}
示例2: ToBasePlayer
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CWeaponGaussGun::ItemPostFrame()
{
//Get the view kick
CBasePlayer *pPlayer = ToBasePlayer( GetOwner() );
if ( !pPlayer )
return;
if ( pPlayer->m_afButtonReleased & IN_ATTACK2 )
{
if ( m_bCharging )
ChargedFire();
}
#ifndef CLIENT_DLL
m_flCoilVelocity = UTIL_Approach( m_flCoilMaxVelocity, m_flCoilVelocity, 10.0f );
m_flCoilAngle = UTIL_AngleMod( m_flCoilAngle + ( m_flCoilVelocity * gpGlobals->frametime ) );
static float fanAngle = 0.0f;
fanAngle = UTIL_AngleMod( fanAngle + 2 );
//Update spinning bits
SetBoneController( 0, fanAngle );
SetBoneController( 1, m_flCoilAngle );
#endif
BaseClass::ItemPostFrame();
}
示例3: IsLocalPlayer
void C_SDKPlayer::LookAtBall(void)
{
const QAngle camAngles = IsLocalPlayer() ? ::input->GetCameraAngles() : m_angCamViewAngles;
float yaw = camAngles[YAW] - EyeAngles()[YAW];
float pitch = camAngles[PITCH];
if (yaw > 180) yaw -= 360;
if (yaw < -180) yaw += 360;
if (pitch > 180) pitch -= 360;
if (pitch < -180) pitch += 360;
//if (yaw > 90) yaw = 180 - yaw;
//if (yaw < -90) yaw = -180 - yaw;
pitch = clamp(pitch, -60, 60);
yaw = clamp(yaw, -120, 120);
float neckVal = clamp(yaw, -50, 50);
SetBoneController(2, neckVal); // Neck
yaw -= neckVal;
float upperSpineVal = clamp(yaw, -40, 40);
SetBoneController(1, upperSpineVal); // Upper spine
yaw -= upperSpineVal;
float lowerSpineVal = clamp(yaw, -30, 30);
SetBoneController(0, lowerSpineVal); // Lower spine
SetBoneController(3, pitch);
}
示例4: Precache
void CBaseTurret::Spawn()
{
Precache( );
pev->nextthink = gpGlobals->time + 1;
pev->movetype = MOVETYPE_FLY;
pev->sequence = 0;
pev->frame = 0;
pev->solid = SOLID_SLIDEBOX;
pev->takedamage = DAMAGE_AIM;
SetBits (pev->flags, FL_MONSTER);
SetUse( &CBaseTurret::TurretUse );
if (( pev->spawnflags & SF_MONSTER_TURRET_AUTOACTIVATE )
&& !( pev->spawnflags & SF_MONSTER_TURRET_STARTINACTIVE ))
{
m_iAutoStart = TRUE;
}
ResetSequenceInfo( );
SetBoneController( 0, 0 );
SetBoneController( 1, 0 );
m_flFieldOfView = VIEW_FIELD_FULL;
// m_flSightRange = TURRET_RANGE;
}
示例5: SetBoneController
void CBaseTurret::Initialize(void)
{
m_iOn = 0;
m_fBeserk = 0;
m_iSpin = 0;
SetBoneController( 0, 0 );
SetBoneController( 1, 0 );
if (m_iBaseTurnRate == 0) m_iBaseTurnRate = TURRET_TURNRATE;
if (m_flMaxWait == 0) m_flMaxWait = TURRET_MAXWAIT;
m_flStartYaw = pev->angles.y;
if (m_iOrientation == 1)
{
pev->idealpitch = 180;
pev->angles.x = 180;
pev->view_ofs.z = -pev->view_ofs.z;
pev->effects |= EF_INVLIGHT;
pev->angles.y = pev->angles.y + 180;
if (pev->angles.y > 360)
pev->angles.y = pev->angles.y - 360;
}
m_vecGoalAngles.x = 0;
if (m_iAutoStart)
{
m_flLastSight = gpGlobals->time + m_flMaxWait;
SetThink(&CBaseTurret::AutoSearchThink);
pev->nextthink = gpGlobals->time + .1;
}
else
SetThink(&CBaseTurret::SUB_DoNothing);
}
示例6: VectorAngles
void CVehicleMortar::UpdateElevation( const Vector &vecTargetVel )
{
QAngle angles;
VectorAngles( vecTargetVel, angles );
m_flMortarPitch = anglemod( -angles[PITCH] );
SetBoneController( 0, m_flMortarYaw );
SetBoneController( 1, m_flMortarPitch );
}
示例7: Spawn
void Spawn( void )
{
SET_MODEL(ENT(pev), "models/player/player_harmor/player_harmor.mdl");
ResetSequenceInfo();
SetBoneController(0, 0);
SetBoneController(1, 0);
SetBoneController(2, 0);
SetBoneController(3, 0);
pev->sequence = 152;
CItem::Spawn( );
}
示例8: switch
//=========================================================
// RunTask
//=========================================================
void CMGargantua::RunTask( Task_t *pTask )
{
switch ( pTask->iTask )
{
case TASK_FLAME_SWEEP:
if ( gpGlobals->time > m_flWaitFinished )
{
FlameDestroy();
TaskComplete();
FlameControls( 0, 0 );
SetBoneController( 0, 0 );
SetBoneController( 1, 0 );
}
else
{
BOOL cancel = FALSE;
Vector angles = g_vecZero;
FlameUpdate();
edict_t *pEnemy = m_hEnemy;
if ( pEnemy )
{
Vector org = pev->origin;
org.z += 64;
Vector dir = UTIL_BodyTarget(pEnemy,org) - org;
angles = UTIL_VecToAngles( dir );
angles.x = -angles.x;
angles.y -= pev->angles.y;
if ( dir.Length() > 400 )
cancel = TRUE;
}
if ( fabs(angles.y) > 60 )
cancel = TRUE;
if ( cancel )
{
m_flWaitFinished -= 0.5;
m_flameTime -= 0.5;
}
// FlameControls( angles.x + 2 * sin(gpGlobals->time*8), angles.y + 28 * sin(gpGlobals->time*8.5) );
FlameControls( angles.x, angles.y );
}
break;
default:
CMBaseMonster::RunTask( pTask );
break;
}
}
示例9: Killed
//=========================================================
// Killed.
//=========================================================
void CBarnacle :: Killed( entvars_t *pevAttacker, int iGib )
{
CBaseMonster *pVictim;
pev->solid = SOLID_NOT;
pev->takedamage = DAMAGE_NO;
if ( m_hEnemy != NULL )
{
pVictim = m_hEnemy->MyMonsterPointer();
if ( pVictim )
{
pVictim->BarnacleVictimReleased();
}
}
// CGib::SpawnRandomGibs( pev, 4, 1 );
switch ( RANDOM_LONG ( 0, 1 ) )
{
case 0: EMIT_SOUND( ENT(pev), CHAN_WEAPON, "barnacle/bcl_die1.wav", 1, ATTN_NORM ); break;
case 1: EMIT_SOUND( ENT(pev), CHAN_WEAPON, "barnacle/bcl_die3.wav", 1, ATTN_NORM ); break;
}
SetActivity ( ACT_DIESIMPLE );
SetBoneController( 0, 0 );
StudioFrameAdvance( 0.1 );
SetNextThink( 0.1 );
SetThink(&CBarnacle :: WaitTillDead );
}
示例10: FlameControls
void CMGargantua :: FlameControls( float angleX, float angleY )
{
if ( angleY < -180 )
angleY += 360;
else if ( angleY > 180 )
angleY -= 360;
if ( angleY < -45 )
angleY = -45;
else if ( angleY > 45 )
angleY = 45;
m_flameX = UTIL_ApproachAngle( angleX, m_flameX, 4 );
m_flameY = UTIL_ApproachAngle( angleY, m_flameY, 8 );
SetBoneController( 0, m_flameY );
SetBoneController( 1, m_flameX );
}
示例11: SetBoneController
//=========================================================
// Initialize - set up the turret, initial think
//=========================================================
void CNPC_BaseTurret::Initialize(void)
{
m_iOn = 0;
m_fBeserk = 0;
m_iSpin = 0;
SetBoneController( 0, 0 );
SetBoneController( 1, 0 );
if (m_iBaseTurnRate == 0) m_iBaseTurnRate = TURRET_TURNRATE;
if (m_flMaxWait == 0) m_flMaxWait = TURRET_MAXWAIT;
QAngle angles = GetAbsAngles();
m_flStartYaw = angles.y;
if (m_iOrientation == TURRET_ORIENTATION_CEILING)
{
angles.x = 180;
angles.y += 180;
if( angles.y > 360 )
angles.y -= 360;
SetAbsAngles( angles );
// pev->idealpitch = 180; //not used?
Vector view_ofs = GetViewOffset();
view_ofs.z = -view_ofs.z;
SetViewOffset( view_ofs );
// pev->effects |= EF_INVLIGHT; //no need
}
m_vecGoalAngles.x = 0;
if (m_iAutoStart)
{
m_flLastSight = gpGlobals->curtime + m_flMaxWait;
SetThink(&CNPC_BaseTurret::AutoSearchThink);
SetNextThink( gpGlobals->curtime + 0.1 );
}
else
{
SetThink( &CBaseEntity::SUB_DoNothing );
}
}
示例12: switch
void CGMan::RunTask(Task_t *pTask)
{
switch(pTask->iTask)
{
case TASK_WAIT:
// look at who I'm talking to
if(m_flTalkTime > gpGlobals->time && m_hTalkTarget != NULL)
{
float yaw = VecToYaw(m_hTalkTarget->pev->origin - pev->origin) - pev->angles.y;
if(yaw > 180)
yaw -= 360;
if(yaw < -180)
yaw += 360;
// turn towards vector
SetBoneController(0, yaw);
}
// look at player, but only if playing a "safe" idle animation
else if(m_hPlayer != NULL && pev->sequence == 0)
{
float yaw = VecToYaw(m_hPlayer->pev->origin - pev->origin) - pev->angles.y;
if(yaw > 180)
yaw -= 360;
if(yaw < -180)
yaw += 360;
// turn towards vector
SetBoneController(0, yaw);
}
else
{
SetBoneController(0, 0);
}
CBaseMonster::RunTask(pTask);
break;
default:
SetBoneController(0, 0);
CBaseMonster::RunTask(pTask);
break;
}
}
示例13: LookupAttachment
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void C_ObjectBaseMannedGun::OnDataChanged( DataUpdateType_t updateType )
{
BaseClass::OnDataChanged(updateType);
if ( updateType == DATA_UPDATE_CREATED )
{
// FIXME: Will this work with build animations models?
m_nBarrelAttachment = LookupAttachment( "barrel" );
m_nBarrelPivotAttachment = LookupAttachment( "barrelpivot" );
m_nStandAttachment = LookupAttachment( "vehicle_feet_passenger0" );
// Find the barrel height in its quiescent state...
Vector vBarrel;
QAngle vBarrelAngles;
GetAttachmentLocal(m_nBarrelAttachment, vBarrel, vBarrelAngles);
m_flBarrelHeight = vBarrel.z;
// HACK HACK: This should be read from a .txt file at some point!!!!
CHudTexture newTexture;
Q_strcpy( newTexture.szTextureFile, "sprites/crosshairs" );
newTexture.rc.left = 0;
newTexture.rc.top = 48;
newTexture.rc.right = newTexture.rc.left + 24;
newTexture.rc.bottom = newTexture.rc.top + 24;
iconCrosshair = gHUD.AddUnsearchableHudIconToList( newTexture );
}
else
{
// Set the bone state..
SetBoneController( 0, m_flGunYaw );
SetBoneController( 1, m_flGunPitch );
if ( m_nMoveStyle == MOVEMENT_STYLE_BARREL_PIVOT )
{
SetBoneController( 2, m_flBarrelPitch );
}
}
}
示例14: Assert
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CObjectBaseMannedGun::FinishMove( CBasePlayer *player, CUserCmd *ucmd, CMoveData *move )
{
BaseClass::FinishMove( player, ucmd, move );
CTFMoveData *pMoveData = (CTFMoveData*)move;
Assert( sizeof(MannedPlasmagunData_t) <= pMoveData->VehicleDataMaxSize() );
MannedPlasmagunData_t *pVehicleData = (MannedPlasmagunData_t*)pMoveData->VehicleData();
m_flGunYaw = pVehicleData->m_flGunYaw;
m_flGunPitch = pVehicleData->m_flGunPitch;
m_flBarrelPitch = pVehicleData->m_flBarrelPitch;
// Set the bone state..
SetBoneController( 0, m_flGunYaw );
SetBoneController( 1, m_flGunPitch );
if ( m_nMoveStyle == MOVEMENT_STYLE_BARREL_PIVOT )
{
SetBoneController( 2, m_flBarrelPitch );
}
NetworkStateChanged();
}
示例15: Precache
//---------------------------------------------------------
//---------------------------------------------------------
void CNPC_MissileDefense::Spawn( void )
{
Precache();
SetModel( "models/missile_defense.mdl" );
UTIL_SetSize( this, Vector( -36, -36 , 0 ), Vector( 36, 36, 64 ) );
SetSolid( SOLID_BBOX );
SetMoveType( MOVETYPE_NONE );
m_takedamage = DAMAGE_YES;
SetBloodColor( DONT_BLEED );
m_iHealth = 10;
m_flFieldOfView = 0.1;
m_NPCState = NPC_STATE_NONE;
CapabilitiesClear();
CapabilitiesAdd ( bits_CAP_INNATE_RANGE_ATTACK1 );
// Hate missiles
AddClassRelationship( CLASS_MISSILE, D_HT, 5 );
m_spawnflags |= SF_NPC_LONG_RANGE;
m_flReloadedTime = gpGlobals->curtime;
InitBoneControllers();
NPCInit();
SetBoneController( MD_BC_YAW, 10 );
SetBoneController( MD_BC_PITCH, 0 );
SetBodygroup( 1, 1 );
SetBodygroup( 2, 1 );
SetBodygroup( 3, 1 );
SetBodygroup( 4, 1 );
m_NPCState = NPC_STATE_IDLE;
}