本文整理汇总了C++中EHANDLE::SetMoveType方法的典型用法代码示例。如果您正苦于以下问题:C++ EHANDLE::SetMoveType方法的具体用法?C++ EHANDLE::SetMoveType怎么用?C++ EHANDLE::SetMoveType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EHANDLE
的用法示例。
在下文中一共展示了EHANDLE::SetMoveType方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DropGrenade
void CNPC_Zombine::DropGrenade( Vector vDir )
{
if ( m_hGrenade == NULL )
return;
m_hGrenade->SetParent( NULL );
m_hGrenade->SetOwnerEntity( NULL );
Vector vGunPos;
QAngle angles;
GetAttachment( "grenade_attachment", vGunPos, angles );
IPhysicsObject *pPhysObj = m_hGrenade->VPhysicsGetObject();
if ( pPhysObj == NULL )
{
m_hGrenade->SetMoveType( MOVETYPE_VPHYSICS );
m_hGrenade->SetSolid( SOLID_VPHYSICS );
m_hGrenade->SetCollisionGroup( COLLISION_GROUP_WEAPON );
m_hGrenade->CreateVPhysics();
}
if ( pPhysObj )
{
pPhysObj->Wake();
pPhysObj->SetPosition( vGunPos, angles, true );
pPhysObj->ApplyForceCenter( vDir * 0.2f );
pPhysObj->RecheckCollisionFilter();
}
m_hGrenade = NULL;
}
示例2: CleanCatchAndThrow
void CNPC_Dog::CleanCatchAndThrow( bool bClearTimers )
{
if ( m_hPhysicsEnt )
{
if ( m_bHasObject == true )
{
IPhysicsObject *pPhysObj = m_hPhysicsEnt->VPhysicsGetObject();
m_hPhysicsEnt->SetParent( NULL );
m_hPhysicsEnt->SetOwnerEntity( NULL );
Vector vGunPos;
QAngle angGunAngles;
GetAttachment( m_iPhysGunAttachment, vGunPos, angGunAngles );
if ( pPhysObj )
{
pPhysObj->Wake();
pPhysObj->RemoveShadowController();
pPhysObj->SetPosition( vGunPos, angGunAngles, true );
}
else
{
Warning( "CleanCatchAndThrow: m_hPhysicsEnt->VPhysicsGetObject == NULL!\n" );
}
m_hPhysicsEnt->SetMoveType( (MoveType_t)m_iContainerMoveType );
if ( pPhysObj )
{
pPhysObj->RecheckCollisionFilter();
}
ClearBeams();
}
m_hPhysicsEnt = NULL;
}
if ( bClearTimers == true )
{
m_bDoCatchThrowBehavior = false;
m_bDoWaitforObjectBehavior = false;
m_flTimeToCatch = 0.0f;
m_flNextSwat = 0.0f;
SetCondition( COND_DOG_LOST_PHYSICS_ENTITY );
}
}
示例3: PickupOrCatchObject
void CNPC_Dog::PickupOrCatchObject( const char *pAttachmentName )
{
if ( m_hPhysicsEnt )
{
InvalidateBoneCache();
int iAttachment = LookupAttachment( pAttachmentName );
if ( iAttachment == 0 )
iAttachment = m_iPhysGunAttachment;
// Move physobject to shadow
IPhysicsObject *pPhysicsObject = m_hPhysicsEnt->VPhysicsGetObject();
if ( pPhysicsObject )
{
pPhysicsObject->SetShadow( 1e4, 1e4, false, false );
pPhysicsObject->UpdateShadow( GetAbsOrigin(), GetAbsAngles(), false, 0 );
}
m_iContainerMoveType = m_hPhysicsEnt->GetMoveType();
m_hPhysicsEnt->SetMoveType( MOVETYPE_NONE );
m_hPhysicsEnt->SetParent( this, iAttachment );
m_hPhysicsEnt->SetLocalOrigin( vec3_origin );
m_hPhysicsEnt->SetLocalAngles( vec3_angle );
m_hPhysicsEnt->SetGroundEntity( NULL );
if ( m_hPhysicsEnt->GetOwnerEntity() == NULL )
m_hPhysicsEnt->SetOwnerEntity( this );
if ( pPhysicsObject )
pPhysicsObject->RecheckCollisionFilter();
m_bHasObject = true;
//Fire Output!
m_OnPickup.FireOutput( this, this );
}
}
示例4: ThrowObject
void CNPC_Dog::ThrowObject( const char *pAttachmentName )
{
if ( m_hPhysicsEnt )
{
m_bHasObject = false;
IPhysicsObject *pPhysObj = m_hPhysicsEnt->VPhysicsGetObject();
if ( pPhysObj )
{
Vector vGunPos;
QAngle angGunAngles;
AngularImpulse angVelocity = RandomAngularImpulse( -250 , -250 ) / pPhysObj->GetMass();
InvalidateBoneCache();
int iAttachment = LookupAttachment( pAttachmentName );
if ( iAttachment == 0 )
iAttachment = m_iPhysGunAttachment;
GetAttachment( iAttachment, vGunPos, angGunAngles );
pPhysObj->Wake();
if ( pPhysObj->GetShadowController() )
{
m_hPhysicsEnt->SetParent( NULL );
m_hPhysicsEnt->SetMoveType( (MoveType_t)m_iContainerMoveType );
m_hPhysicsEnt->SetOwnerEntity( this );
pPhysObj->RemoveShadowController();
pPhysObj->SetPosition( m_hPhysicsEnt->GetLocalOrigin(), m_hPhysicsEnt->GetLocalAngles(), true );
pPhysObj->RecheckCollisionFilter();
pPhysObj->RecheckContactPoints();
}
if ( m_hThrowTarget == NULL )
#ifdef SecobMod__Enable_Fixed_Multiplayer_AI
m_hThrowTarget = UTIL_GetNearestVisiblePlayer(this);
#else
m_hThrowTarget = AI_GetSinglePlayer();
#endif //SecobMod__Enable_Fixed_Multiplayer_AI
Vector vThrowDirection;
if ( m_hThrowTarget )
{
Vector vThrowOrigin = m_hThrowTarget->GetAbsOrigin();
if ( m_hThrowTarget->IsPlayer() )
vThrowOrigin = vThrowOrigin + Vector( random->RandomFloat( -128, 128 ), random->RandomFloat( -128, 128 ), 0 );
Vector vecToss = VecCheckToss( this, vGunPos, vThrowOrigin, m_flThrowArcModifier, 1.0f, true );
if( vecToss == vec3_origin )
{
// Fix up an impossible throw so dog will at least toss the box in the target's general direction instead of dropping it.
// Also toss it up in the air so it will fall down and break. (Just throw the box up at a 45 degree angle)
Vector forward, up;
GetVectors( &forward, NULL, &up );
vecToss = forward + up;
VectorNormalize( vecToss );
vecToss *= pPhysObj->GetMass() * 30.0f;
}
vThrowDirection = vecToss + ( m_hThrowTarget->GetSmoothedVelocity() / 2 );
Vector vLinearDrag;
Vector unitVel = vThrowDirection;
VectorNormalize( unitVel );
float flTest = 1000 / vThrowDirection.Length();
float flDrag = pPhysObj->CalculateLinearDrag( vThrowDirection );
vThrowDirection = vThrowDirection + ( unitVel * ( flDrag * flDrag ) ) / flTest;
pPhysObj->SetVelocity( &vThrowDirection, &angVelocity );
m_flTimeToCatch = gpGlobals->curtime + dog_max_wait_time.GetFloat();
//Don't start pulling until the object is away from me.
//We base the time on the throw velocity.
m_flTimeToPull = gpGlobals->curtime + ( 1000 / vThrowDirection.Length() );
}
//Fire Output!
m_OnThrow.FireOutput( this, this );
ClearBeams();
if ( m_bBeamEffects == true )
{
EmitSound( "Weapon_PhysCannon.Launch" );
//.........这里部分代码省略.........
示例5: PrescheduleThink
//.........这里部分代码省略.........
m_flTroopDeployPause = m_flTimeTakeOff + 2; // only drop once
}
}
// manage engine wash and volume
if ( m_flTimeTakeOff - gpGlobals->curtime < 0.5f )
{
m_engineThrust = UTIL_Approach( 1.0f, m_engineThrust, 0.1f );
DoRotorWash();
}
else
{
float idleVolume = 0.2f;
m_engineThrust = UTIL_Approach( idleVolume, m_engineThrust, 0.04f );
if ( m_engineThrust > idleVolume )
{
DoRotorWash(); // make sure we're kicking up dust/water as long as engine thrust is up
}
}
if( gpGlobals->curtime > m_flTimeTakeOff )
{
m_iLandState = LANDING_LIFTOFF;
SetActivity( (Activity)ACT_DROPSHIP_LIFTOFF );
m_engineThrust = 1.0f; // ensure max volume once we're airborne
if ( m_bIsFiring )
{
StopCannon(); // kill cannon sounds if they are on
}
// detach container from ship
if ( m_hContainer && m_leaveCrate )
{
m_hContainer->SetParent(NULL);
m_hContainer->SetMoveType( (MoveType_t)m_iContainerMoveType );
// If the container has a physics object, remove it's shadow
IPhysicsObject *pPhysicsObject = m_hContainer->VPhysicsGetObject();
if ( pPhysicsObject )
{
pPhysicsObject->RemoveShadowController();
}
m_hContainer = NULL;
}
}
}
break;
case LANDING_LIFTOFF:
{
// give us some clearance before changing back to larger hull -- keeps ship from getting stuck on
// things like the player, etc since we "pop" the hull...
if ( GetAltitude() > 120 )
{
m_OnFinishedDropoff.FireOutput( this, this );
m_iLandState = LANDING_NO;
// change bounding box back to normal ship hull
Vector vecBBMin, vecBBMax;
ExtractBbox( SelectHeaviestSequence( ACT_DROPSHIP_DEPLOY_IDLE ), vecBBMin, vecBBMax );
UTIL_SetSize( this, vecBBMin, vecBBMax );
Relink();
}
}
break;