本文整理汇总了C++中SetAbsOrigin函数的典型用法代码示例。如果您正苦于以下问题:C++ SetAbsOrigin函数的具体用法?C++ SetAbsOrigin怎么用?C++ SetAbsOrigin使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SetAbsOrigin函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetAbsOrigin
void CBaseDoor::SetToggleState( int state )
{
if( state == TS_AT_TOP )
SetAbsOrigin( m_vecPosition2 );
else
SetAbsOrigin( m_vecPosition1 );
}
示例2: STRING
void CSDKPlayer::MoveToNextIntroCamera()
{
m_pIntroCamera = gEntList.FindEntityByClassname( m_pIntroCamera, "point_viewcontrol" );
// if m_pIntroCamera is NULL we just were at end of list, start searching from start again
if(!m_pIntroCamera)
m_pIntroCamera = gEntList.FindEntityByClassname(m_pIntroCamera, "point_viewcontrol");
// find the target
CBaseEntity *Target = NULL;
if( m_pIntroCamera )
{
Target = gEntList.FindEntityByName( NULL, STRING(m_pIntroCamera->m_target) );
}
// if we still couldn't find a camera, goto T spawn
if(!m_pIntroCamera)
m_pIntroCamera = gEntList.FindEntityByClassname(m_pIntroCamera, "info_player_terrorist");
SetViewOffset( vec3_origin ); // no view offset
UTIL_SetSize( this, vec3_origin, vec3_origin ); // no bbox
if( !Target ) //if there are no cameras(or the camera has no target, find a spawn point and black out the screen
{
if ( m_pIntroCamera.IsValid() )
SetAbsOrigin( m_pIntroCamera->GetAbsOrigin() + VEC_VIEW );
SetAbsAngles( QAngle( 0, 0, 0 ) );
m_pIntroCamera = NULL; // never update again
return;
}
Vector vCamera = Target->GetAbsOrigin() - m_pIntroCamera->GetAbsOrigin();
Vector vIntroCamera = m_pIntroCamera->GetAbsOrigin();
VectorNormalize( vCamera );
QAngle CamAngles;
VectorAngles( vCamera, CamAngles );
SetAbsOrigin( vIntroCamera );
SetAbsAngles( CamAngles );
SnapEyeAngles( CamAngles );
m_fIntroCamTime = gpGlobals->curtime + 6;
}
示例3: SetOwnerEntity
bool CBoneFollower::Init( CBaseEntity *pOwner, const char *pModelName, solid_t &solid, const Vector &position, const QAngle &orientation )
{
SetOwnerEntity( pOwner );
UTIL_SetModel( this, pModelName );
m_fEffects |= EF_NODRAW; // invisible
#if VISUALIZE_FOLLOWERS_BOUNDINGBOX
m_debugOverlays |= OVERLAY_BBOX_BIT;
#endif
m_modelIndex = modelinfo->GetModelIndex( pModelName );
m_solidIndex = solid.index;
SetAbsOrigin( position );
SetAbsAngles( orientation );
SetMoveType( MOVETYPE_PUSH );
SetSolid( SOLID_VPHYSICS );
SetCollisionGroup( pOwner->GetCollisionGroup() );
AddSolidFlags( FSOLID_CUSTOMRAYTEST | FSOLID_CUSTOMBOXTEST );
solid.params.pGameData = (void *)this;
IPhysicsObject *pPhysics = VPhysicsInitShadow( false, false, &solid );
if ( !pPhysics )
return false;
pPhysics->SetCallbackFlags( pPhysics->GetCallbackFlags() | CALLBACK_GLOBAL_TOUCH );
pPhysics->EnableGravity( false );
return true;
}
示例4: SetAbsOrigin
void CFuncPlat::Setup( void )
{
//pev->noiseMovement = MAKE_STRING("plats/platmove1.wav");
//pev->noiseStopMoving = MAKE_STRING("plats/platstop1.wav");
if( m_flTLength == 0 )
m_flTLength = 80;
if( m_flTWidth == 0 )
m_flTWidth = 10;
pev->angles = g_vecZero;
pev->solid = SOLID_BSP;
pev->movetype = MOVETYPE_PUSH;
SetAbsOrigin( GetAbsOrigin() ); // set size and link into world
SetSize( pev->mins, pev->maxs );
SetModel( STRING( pev->model ) );
// vecPosition1 is the top position, vecPosition2 is the bottom
m_vecPosition1 = GetAbsOrigin();
m_vecPosition2 = GetAbsOrigin();
if( m_flHeight != 0 )
m_vecPosition2.z = GetAbsOrigin().z - m_flHeight;
else
m_vecPosition2.z = GetAbsOrigin().z - pev->size.z + 8;
if( pev->speed == 0 )
pev->speed = 150;
if( m_volume == 0 )
m_volume = 0.85;
}
示例5: TrackTouch
//=========================================================
// Tracking Hornet hit something
//=========================================================
void CHornet :: TrackTouch ( CBaseEntity *pOther )
{
if ( pOther->edict() == pev->owner || pOther->pev->modelindex == pev->modelindex )
{// bumped into the guy that shot it.
pev->solid = SOLID_NOT;
return;
}
if ( IRelationship( pOther ) <= R_NO )
{
// hit something we don't want to hurt, so turn around.
Vector vecVelocity = GetAbsVelocity();
vecVelocity = vecVelocity.Normalize();
vecVelocity.x *= -1;
vecVelocity.y *= -1;
SetAbsVelocity( vecVelocity );
SetAbsOrigin( GetAbsOrigin() + GetAbsVelocity() * 4 ); // bounce the hornet off a bit.
SetAbsVelocity( GetAbsVelocity() * m_flFlySpeed );
return;
}
DieTouch( pOther );
}
示例6: Precache
void CControllerHeadBall::Spawn( void )
{
Precache();
// motor
pev->movetype = MOVETYPE_FLY;
pev->solid = SOLID_BBOX;
SetModel( "sprites/xspark4.spr" );
pev->rendermode = kRenderTransAdd;
pev->rendercolor.x = 255;
pev->rendercolor.y = 255;
pev->rendercolor.z = 255;
pev->renderamt = 255;
pev->scale = 2.0;
SetSize( Vector( 0, 0, 0 ), Vector( 0, 0, 0 ) );
SetAbsOrigin( GetAbsOrigin() );
SetThink( &CControllerHeadBall::HuntThink );
SetTouch( &CControllerHeadBall::BounceTouch );
m_vecIdeal = Vector( 0, 0, 0 );
pev->nextthink = gpGlobals->time + 0.1;
m_hOwner = Instance( pev->owner );
pev->dmgtime = gpGlobals->time;
}
示例7: SetMoveType
void CPlantedC4::Init( CCSPlayer *pevOwner, Vector vecStart, QAngle vecAngles )
{
SetMoveType( MOVETYPE_NONE );
SetSolid( SOLID_NONE );
SetModel( PLANTED_C4_MODEL ); // Change this to c4 model
SetCollisionBounds( Vector( 0, 0, 0 ), Vector( 8, 8, 8 ) );
SetAbsOrigin( vecStart );
SetAbsAngles( vecAngles );
SetOwnerEntity( pevOwner );
// Detonate in "time" seconds
SetThink( &CPlantedC4::C4Think );
SetNextThink( gpGlobals->curtime + 0.1f );
m_flTimerLength = mp_c4timer.GetInt();
m_flC4Blow = gpGlobals->curtime + m_flTimerLength;
m_flNextDefuse = 0;
m_bStartDefuse = false;
m_bBombTicking = true;
SetFriction( 0.9 );
m_flDefuseLength = 0.0f;
SpawnControlPanels();
}
示例8: SetAbsOrigin
void CPropAPC2::Materialize( void )
{
//trace_t tr;
//UTIL_TraceHull( m_vOriginalSpawnOrigin, m_vOriginalSpawnOrigin, Vector(-38,-38,-38),Vector(38,38,38), MASK_SOLID, this, COLLISION_GROUP_NONE, &tr );
//if ( (tr.startsolid || tr.allsolid) && m_iSpawnTry<3 )
//{
// //Try again in a second.
// SetContextThink(&QUA_Strider::Materialize, gpGlobals->curtime + 1.0f, "RESPAWNING" );
// SetNextThink( gpGlobals->curtime + 1.0f );
// m_iSpawnTry++;
// return;
//}
SetAbsOrigin( InicialSpawn );
SetAbsAngles( InicialAngle );
KeyValue( "model", "models/combine_apc.mdl" );
KeyValue( "solid", "6" );
KeyValue( "targetname", "elapc" );
KeyValue( "vehiclescript", "scripts/vehicles/apc.txt" );
Teleport( &InicialSpawn, &InicialAngle, NULL );
Spawn();
Activate();
SetThink( &CPropAPC2::Think );
SetNextThink( gpGlobals->curtime);
}
示例9: Release
//-----------------------------------------------------------------------------
// Purpose:
// Input : *pszModelName -
// vecOrigin -
// vecForceDir -
// vecAngularImp -
// Output : Returns true on success, false on failure.
//-----------------------------------------------------------------------------
bool C_Gib::InitializeGib( const char *pszModelName, Vector vecOrigin, Vector vecForceDir, AngularImpulse vecAngularImp, float flLifetime )
{
if ( InitializeAsClientEntity( pszModelName, RENDER_GROUP_OPAQUE_ENTITY ) == false )
{
Release();
return false;
}
SetAbsOrigin( vecOrigin );
SetCollisionGroup( COLLISION_GROUP_DEBRIS );
solid_t tmpSolid;
PhysModelParseSolid( tmpSolid, this, GetModelIndex() );
m_pPhysicsObject = VPhysicsInitNormal( SOLID_VPHYSICS, 0, false, &tmpSolid );
if ( m_pPhysicsObject )
{
float flForce = m_pPhysicsObject->GetMass();
vecForceDir *= flForce;
m_pPhysicsObject->ApplyForceOffset( vecForceDir, GetAbsOrigin() );
m_pPhysicsObject->SetCallbackFlags( m_pPhysicsObject->GetCallbackFlags() | CALLBACK_GLOBAL_TOUCH | CALLBACK_GLOBAL_TOUCH_STATIC );
}
else
{
// failed to create a physics object
Release();
return false;
}
SetNextClientThink( gpGlobals->curtime + flLifetime );
return true;
}
示例10: StopSound
//-----------------------------------------------------------------------------
// Creates the explosion effect
//-----------------------------------------------------------------------------
void CEnvHeadcrabCanister::Detonate( )
{
// Send the impact output
m_OnImpacted.FireOutput( this, this, 0 );
if ( !HasSpawnFlags( SF_NO_IMPACT_SOUND ) )
{
StopSound( "HeadcrabCanister.IncomingSound" );
EmitSound( "HeadcrabCanister.Explosion" );
}
// If we're supposed to be removed, do that now
if ( HasSpawnFlags( SF_REMOVE_ON_IMPACT ) )
{
SetAbsOrigin( m_vecImpactPosition );
SetModel( ENV_HEADCRABCANISTER_BROKEN_MODEL );
SetMoveType( MOVETYPE_NONE );
IncrementInterpolationFrame();
m_bLanded = true;
// Become invisible so our trail can finish up
AddEffects( EF_NODRAW );
SetSolidFlags( FSOLID_NOT_SOLID );
SetThink( &CEnvHeadcrabCanister::SUB_Remove );
SetNextThink( gpGlobals->curtime + ENV_HEADCRABCANISTER_TRAIL_TIME );
return;
}
// Test for damaging things
TestForCollisionsAgainstWorld( m_vecImpactPosition );
// Shake the screen unless flagged otherwise
if ( !HasSpawnFlags( SF_NO_SHAKE ) )
{
CBasePlayer *pPlayer = UTIL_GetNearestPlayer(GetAbsOrigin());
// If the player is on foot, then do a more limited shake
float shakeRadius = ( pPlayer && pPlayer->IsInAVehicle() ) ? sk_env_headcrabcanister_shake_radius_vehicle.GetFloat() : sk_env_headcrabcanister_shake_radius.GetFloat();
UTIL_ScreenShake( m_vecImpactPosition, sk_env_headcrabcanister_shake_amplitude.GetFloat(), 150.0, 1.0, shakeRadius, SHAKE_START );
}
// Do explosion effects
if ( !HasSpawnFlags( SF_NO_IMPACT_EFFECTS ) )
{
// Normal explosion
ExplosionCreate( m_vecImpactPosition, GetAbsAngles(), this, 50.0f, 500.0f,
SF_ENVEXPLOSION_NODLIGHTS | SF_ENVEXPLOSION_NOSPARKS | SF_ENVEXPLOSION_NODAMAGE | SF_ENVEXPLOSION_NOSOUND, 1300.0f );
// Dust explosion
AR2Explosion *pExplosion = AR2Explosion::CreateAR2Explosion( m_vecImpactPosition );
if( pExplosion )
{
pExplosion->SetLifetime(10);
}
}
}
示例11: KeyValue
void CFuncRotating :: KeyValue( KeyValueData* pkvd)
{
if( FStrEq( pkvd->szKeyName, "fanfriction" ))
{
m_flFanFriction = Q_atof( pkvd->szValue ) / 100.0f;
pkvd->fHandled = TRUE;
}
else if( FStrEq( pkvd->szKeyName, "spawnorigin" ))
{
Vector tmp = Q_atov( pkvd->szValue );
if( tmp != g_vecZero ) SetAbsOrigin( tmp );
}
else if( FStrEq( pkvd->szKeyName, "sounds" ))
{
m_sounds = ALLOC_STRING( pkvd->szValue );
pkvd->fHandled = TRUE;
}
else if( FStrEq( pkvd->szKeyName, "volume" ))
{
m_flVolume = bound( 0.0f, Q_atof( pkvd->szValue ) / 10.0f, 1.0f );
pkvd->fHandled = TRUE;
}
else
{
CBaseDelay::KeyValue( pkvd );
}
}
示例12: IRelationType
//=========================================================
// Tracking Hornet hit something
//=========================================================
void CNPC_Hornet::TrackTouch ( CBaseEntity *pOther )
{
if ( !pOther->IsSolid() || pOther->IsSolidFlagSet(FSOLID_VOLUME_CONTENTS) )
{
return;
}
if ( pOther == GetOwnerEntity() || pOther->GetModelIndex() == GetModelIndex() )
{// bumped into the guy that shot it.
//SetSolid( SOLID_NOT );
return;
}
int nRelationship = IRelationType( pOther );
if ( (nRelationship == D_FR || nRelationship == D_NU || nRelationship == D_LI) )
{
// hit something we don't want to hurt, so turn around.
Vector vecVel = GetAbsVelocity();
VectorNormalize( vecVel );
vecVel.x *= -1;
vecVel.y *= -1;
SetAbsOrigin( GetAbsOrigin() + vecVel * 4 ); // bounce the hornet off a bit.
SetAbsVelocity( vecVel * m_flFlySpeed );
return;
}
DieTouch( pOther );
}
示例13: SetModelName
void C_PortalGhostRenderable::PerFrameUpdate( void )
{
if( m_pGhostedRenderable )
{
SetModelName( m_pGhostedRenderable->GetModelName() );
SetModelIndex( m_pGhostedRenderable->GetModelIndex() );
SetEffects( m_pGhostedRenderable->GetEffects() | EF_NOINTERP );
m_flAnimTime = m_pGhostedRenderable->m_flAnimTime;
if( m_bSourceIsBaseAnimating )
{
C_BaseAnimating *pSource = (C_BaseAnimating *)m_pGhostedRenderable;
SetCycle( pSource->GetCycle() );
SetSequence( pSource->GetSequence() );
m_nBody = pSource->m_nBody;
m_nSkin = pSource->m_nSkin;
}
}
// Set position and angles relative to the object it's ghosting
Vector ptNewOrigin = m_matGhostTransform * m_pGhostedRenderable->GetAbsOrigin();
QAngle qNewAngles = TransformAnglesToWorldSpace( m_pGhostedRenderable->GetAbsAngles(), m_matGhostTransform.As3x4() );
SetAbsOrigin( ptNewOrigin );
SetAbsAngles( qNewAngles );
AddEffects( EF_NOINTERP );
RemoveFromInterpolationList();
g_pClientLeafSystem->RenderableChanged( RenderHandle() );
}
示例14: UTIL_FindEntityByTargetname
void CFuncTrain::Activate( void )
{
// Not yet active, so teleport to first target
if( !m_activated )
{
m_activated = true;
CBaseEntity* pTarg = UTIL_FindEntityByTargetname( nullptr, GetTarget() );
//Use the world if no target was found. Replicates SDK behavior. - Solokiller
if( !pTarg )
{
pTarg = CWorld::GetInstance();
}
pev->target = MAKE_STRING( pTarg->GetTarget() );
//TODO change to EHANDLE - Solokiller
m_pevCurrentTarget = pTarg->pev;// keep track of this since path corners change our target for us.
SetAbsOrigin( pTarg->GetAbsOrigin() - ( pev->mins + pev->maxs ) * 0.5 );
if( !HasTargetname() )
{ // not triggered, so start immediately
pev->nextthink = pev->ltime + 0.1;
SetThink( &CFuncTrain::Next );
}
else
pev->spawnflags |= SF_TRAIN_WAIT_RETRIGGER;
}
}
示例15: Precache
void CControllerZapBall::Spawn( void )
{
Precache();
// motor
pev->movetype = MOVETYPE_FLY;
pev->solid = SOLID_BBOX;
SetModel( "sprites/xspark4.spr" );
pev->rendermode = kRenderTransAdd;
pev->rendercolor.x = 255;
pev->rendercolor.y = 255;
pev->rendercolor.z = 255;
pev->renderamt = 255;
pev->scale = 0.5;
SetSize( Vector( 0, 0, 0 ), Vector( 0, 0, 0 ) );
SetAbsOrigin( GetAbsOrigin() );
SetThink( &CControllerZapBall::AnimateThink );
SetTouch( &CControllerZapBall::ExplodeTouch );
m_hOwner = Instance( pev->owner );
pev->dmgtime = gpGlobals->time; // keep track of when ball spawned
pev->nextthink = gpGlobals->time + 0.1;
}