当前位置: 首页>>代码示例>>C++>>正文


C++ SetVelocity函数代码示例

本文整理汇总了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
	}
开发者ID:Mikalai,项目名称:punk_project_a,代码行数:9,代码来源:audio_source.cpp

示例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);
}
开发者ID:hunterkill1987,项目名称:StarFighter,代码行数:9,代码来源:Player.cpp

示例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)));
	}
开发者ID:plainoldcj,项目名称:breaking_bricks,代码行数:18,代码来源:ent_ball.cpp

示例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);
		}
	}
开发者ID:ghoulsblade,项目名称:lugreexample,代码行数:9,代码来源:lugre_sound_fmod.cpp

示例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);
}
开发者ID:siqihuang,项目名称:rigidbody-simulation,代码行数:10,代码来源:RigidBody.cpp

示例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);
}
开发者ID:iancarnation,项目名称:AIE_Projects,代码行数:11,代码来源:Sprite.cpp

示例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";
}
开发者ID:Rinirihiriro,项目名称:SmallPlanet,代码行数:10,代码来源:Smoke.cpp

示例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());
}
开发者ID:kanc,项目名称:UTAD,代码行数:11,代码来源:AudioSource.cpp

示例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();
}
开发者ID:TheThow,项目名称:OpenClonk-Stuff,代码行数:11,代码来源:Script.c

示例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();
	}
}
开发者ID:Asunaya,项目名称:RefinedGunz,代码行数:11,代码来源:ZActor.cpp

示例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);
}
开发者ID:cgrobbelaar,项目名称:svofski,代码行数:11,代码来源:motion.cpp

示例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;
}
开发者ID:caldera,项目名称:MultiplayerBook,代码行数:11,代码来源:Yarn.cpp

示例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;
  
}
开发者ID:CFDOPT,项目名称:SU2,代码行数:41,代码来源:variable_direct_mean.cpp

示例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);
}
开发者ID:thomhughes,项目名称:Awe,代码行数:12,代码来源:EnginePhysics.cpp

示例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);
}
开发者ID:9heart,项目名称:spring,代码行数:12,代码来源:Building.cpp


注:本文中的SetVelocity函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。