本文整理汇总了C++中IPhysicsObject::SetVelocityInstantaneous方法的典型用法代码示例。如果您正苦于以下问题:C++ IPhysicsObject::SetVelocityInstantaneous方法的具体用法?C++ IPhysicsObject::SetVelocityInstantaneous怎么用?C++ IPhysicsObject::SetVelocityInstantaneous使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPhysicsObject
的用法示例。
在下文中一共展示了IPhysicsObject::SetVelocityInstantaneous方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Deflected
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CTFWeaponBaseGrenadeProj::Deflected( CBaseEntity *pDeflectedBy, Vector &vecDir )
{
IPhysicsObject *pPhysicsObject = VPhysicsGetObject();
if ( pPhysicsObject )
{
Vector vecOldVelocity, vecVelocity;
pPhysicsObject->GetVelocity( &vecOldVelocity, NULL );
float flVel = vecOldVelocity.Length();
vecVelocity = vecDir;
vecVelocity *= flVel;
AngularImpulse angVelocity( ( 600, random->RandomInt( -1200, 1200 ), 0 ) );
// Now change grenade's direction.
pPhysicsObject->SetVelocityInstantaneous( &vecVelocity, &angVelocity );
}
CBaseCombatCharacter *pBCC = pDeflectedBy->MyCombatCharacterPointer();
IncremenentDeflected();
m_hDeflectOwner = pDeflectedBy;
SetThrower( pBCC );
ChangeTeam( pDeflectedBy->GetTeamNumber() );
if ( !TFGameRules()->IsDeathmatch() )
m_nSkin = pDeflectedBy->GetTeamNumber() - 2;
// TODO: Live TF2 adds white trail to reflected pipes and stickies. We need one as well.
}
示例2: SetVelocity
void CGETKnife::SetVelocity( const Vector &velocity, const AngularImpulse &angVelocity )
{
IPhysicsObject *pPhysicsObject = VPhysicsGetObject();
if ( pPhysicsObject )
{
pPhysicsObject->SetVelocityInstantaneous( &velocity, &angVelocity );
}
}