本文整理汇总了C++中SetVelocity函数的典型用法代码示例。如果您正苦于以下问题:C++ SetVelocity函数的具体用法?C++ SetVelocity怎么用?C++ SetVelocity使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SetVelocity函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetVelocity
void Source::SetVelocity(float x, float y, float z)
{
#ifdef HAS_AUDIO_SOURCE
impl->SetVelocity(Math::vec3(x, y, z));
#else
(void)x; (void)y; (void)z;
throw System::PunkException(L"Audio source is not available");
#endif
}
示例2: Vector2
void Player::Move()
{
//fprintf(stderr, "Move Forward\n");
Vector2 rotation = this->GetRotation();
Vector2 velocity = this->GetVelocity();
rotation = Vector2(GetRotation().GetX(), GetRotation().GetY());
velocity = velocity + rotation * 4 * pEngine->GetDeltaTime();
SetVelocity(velocity);
}
示例3: TouchEffects
void Ball::TouchBoard(BoardSide side) {
TouchEffects();
XBOX::Rumble(1, 0.2f, 4000.0f);
_bounceSound->Play();
if(!_dying && BOTTOM == side) {
_dying = true;
_health = 1.0f;
_decayRate = 2.0f;
}
/*
this makes the game a little less predictable and prevents the
ball from bouncing horizontally all the time
*/
if(TOP == side || BOTTOM == side) SetVelocity(MATH::Rotate(GetVelocity(), sf::Randomizer::Random(-0.1f, 0.1f)));
else SetVelocity(MATH::Rotate(GetVelocity(), sf::Randomizer::Random(-0.2f, 0.2f)));
}
示例4: cSoundSourceFmod
cSoundSourceFmod(cSoundSystemFmod *soundsystem, const float x, const float y, const float z, const char *filename) : mSoundSystem(soundsystem), mpChannel(0), mb3D(true), mpSound(0), mfMinDistance(100.0f), mfMaxDistance(100000.0f) {
if(mSoundSystem && mSoundSystem->mpSystem){
result = FMOD_System_CreateStream(mSoundSystem->mpSystem, filename, (FMOD_MODE)(FMOD_SOFTWARE | FMOD_3D), 0, &mpSound);
ERRCHECK(result);
SetPosition(x,y,z);
SetVelocity(0,0,0);
}
}
示例5: GetInverseMass
void RigidBody::ApplyImpulse(Vector3 const& impulse, Vector3 const& point)
{
if(HasInfiniteMass()) return;
Vector3 deltaVelocity = impulse * GetInverseMass();
SetVelocity(GetVelocity() + deltaVelocity);
Vector3 deltaOmega = GetInverseInertialTensor() * (point-GetPosition()).crossProduct(impulse);
SetAngularVelocity(GetAngularVelocity() + deltaOmega);
}
示例6: vect
// calculates velocity for going towards a certain vector
void Sprite::SetVelocityToward(const Vector2D a_rV2)
{
/*float fAngle = GetPosition().GetAngle(a_rV2);
Vector2D vect(cos(fAngle), sin(fAngle));
SetVelocity(vect);*/
Vector2D direction((m_oPosition.m_fX - a_rV2.m_fX), (m_oPosition.m_fY - a_rV2.m_fY));
direction.Normalize();
SetVelocity(direction);
}
示例7: SetVelocity
Smoke::Smoke(const int type, const float x, const float y)
:GameObj("smoke", x, y, -1)
{
fFrame = (float)type;
iLifeTimer = 60;
SetVelocity((float)Random::rand.NextDouble()*4-2, -0.125f);
bTransform = true;
vScale.x = vScale.y = 0;
sObject_tag = "smoke";
}
示例8: alGenSources
AudioSource::AudioSource(AudioBuffer* buff)
{
alGenSources(1, &source);
SetGain(1);
SetPitch(1);
SetLooping(false);
SetPosition(0,0,0);
SetVelocity(0,0,0);
alSourcei(source, AL_BUFFER, buff->GetBuffer());
}
示例9: Blocked
func Blocked(object clonk)
{
AddEffect("Blocked", this, 1, 1, this);
Sound("Ball::ball_blocked", false, 20);
SetRDir(20);
var objectangle = Angle(clonk->GetX(), clonk->GetY(), GetX(), GetY());
//var tangle = 2* ( (objectangle + 90)%360 - entryangle) + entryangle;
SetVelocity(objectangle, Speed);
Idle();
}
示例10: SetPosition
void ZActor::InputBasicInfo(ZBasicInfo* pni, BYTE anistate)
{
if (!CheckFlag(AF_MY_CONTROL))
{
SetPosition(pni->position);
SetVelocity(pni->velocity);
SetDirection(pni->direction);
m_Animation.ForceAniState(anistate);
m_fLastBasicInfo = g_pGame->GetTime();
}
}
示例11: SetVelocity
void VectorPath::Init(Point from, Point to, int velocity) {
loc.moveto(from);
float dist = MathUtil::dist(from, to);
delta.moveto((to.x-from.x)/dist,
(to.y-from.y)/dist,
(to.z-from.z)/dist);
step = 1 + (int)roundf(dist);
accel = 0;
SetVelocity(velocity);
//xprintf("VP:["); from.print(); to.print(); xprintf(" steps=%d]\n", step);
}
示例12: SetPlayerId
void Yarn::InitFromShooter( GameObjectPtr inShooter, GameObjectPtr inTarget )
{
SetPlayerId( inShooter->GetPlayerId() );
Vector3 forward = inTarget->GetLocation() - inShooter->GetLocation();
SetVelocity( forward * kMuzzleSpeed );
SetLocation( inShooter->GetLocation() );
mShooterCat = inShooter;
mTargetCat = inTarget;
}
示例13: SetVelocity
bool CEulerVariable::SetPrimVar_Compressible(CConfig *config) {
unsigned short iVar;
bool check_dens = false, check_press = false, check_sos = false, check_temp = false, RightVol = true;
double Gas_Constant = config->GetGas_ConstantND();
double Gamma = config->GetGamma();
SetVelocity(); // Computes velocity and velocity^2
check_dens = SetDensity(); // Check the density
check_press = SetPressure(Gamma); // Requires velocity2 computation.
check_sos = SetSoundSpeed(Gamma); // Requires pressure computation.
check_temp = SetTemperature(Gas_Constant); // Requires pressure computation.
/*--- Check that the solution has a physical meaning ---*/
if (check_dens || check_press || check_sos || check_temp) {
/*--- Copy the old solution ---*/
for (iVar = 0; iVar < nVar; iVar++)
Solution[iVar] = Solution_Old[iVar];
/*--- Recompute the primitive variables ---*/
SetVelocity();
check_dens = SetDensity();
check_press = SetPressure(Gamma);
check_sos = SetSoundSpeed(Gamma);
check_temp = SetTemperature(Gas_Constant);
RightVol = false;
}
/*--- Set enthalpy ---*/
SetEnthalpy(); // Requires pressure computation.
return RightVol;
}
示例14: RandomVelocities
void RandomVelocities(PhysXObject* object, int powerMax, int seedMultiplier)
{
PxVec3 dir = CreateRandomVector(powerMax, seedMultiplier);
srand((time(NULL) * seedMultiplier) + time(NULL));
int power = rand() % powerMax;
dir.normalize();
SetVelocity(dir * power, object);
}
示例15: GetHeadingFromFacing
void CBuilding::ForcedMove(const float3& newPos) {
heading = GetHeadingFromFacing(buildFacing);
frontdir = GetVectorFromHeading(heading);
SetVelocity(ZeroVector);
Move(CGameHelper::Pos2BuildPos(BuildInfo(unitDef, newPos, buildFacing), true), false);
UpdateMidAndAimPos();
CUnit::ForcedMove(pos);
unitLoader->FlattenGround(this);
}