void Racer::applyForces(float seconds)
{
	hkVector4 aVel, vel = body->getLinearVelocity();
	float dot = vel.dot3(vel);
	aVel = body->getAngularVelocity();
	float aDot = aVel.dot3(aVel);

	// Only want to be automatically braking if the player
	// isn't trying to move or already moving
	if (((dot > 0.0f) && (dot < 6.0f) && (aDot != 0.0f)) &&
		(currentAcceleration == 0.0f))
	{
		brake(seconds);
	}
	else
	{
		applyFriction(seconds);
	}

	applyTireRaycast();
	applySprings(seconds);
	applyDrag(seconds);
	

	if (laserTime > 0.0f)
	{
		laserTime -= seconds;
	}


	if (respawnTimer > 0.0f)
	{
		respawnTimer -= seconds;

		SmokeParticle* smoke = new SmokeParticle();
		hkVector4 pos = body->getPosition();
		smoke->setPosition(&pos);
		SmokeSystem::system->addSmoke(ROCKET_SMOKE, smoke);
		smoke = NULL;
	}
	else if (!respawned && (respawnTimer <= 0.0f))
	{
		respawnTimer = 0.0f;
		respawned = true;
		respawn();
	}
}
void Racer::respawn()
{
	SmokeParticle* smoke = new SmokeParticle();
	hkVector4 pos = body->getPosition();
	smoke->setPosition(&pos);
	SmokeSystem::system->addSmoke(EXPLOSION_SMOKE, smoke);
	smoke = NULL;

	Sound::sound->playSoundEffect(SFX_CAREXPLODE, emitter);

	deathPos(1) += 3.0f;
	reset(&deathPos, 0);

	body->setPositionAndRotation(deathPos, deathRot);

	health = 100;

	update();
}
void Landmine::explode()
{
	destroyed = true;

	Sound::sound->playSoundEffect(SFX_EXPLOSION, emitter);
	Explosion* explosion = new Explosion((hkTransform*) &(body->getTransform()), owner);

	explosion->doDamage();
	explosion = NULL;

	SmokeParticle* smoke = new SmokeParticle();

	hkVector4 pos;
	pos.setXYZ(body->getPosition());

	smoke->setPosition(&pos);
	SmokeSystem::system->addSmoke(EXPLOSION_SMOKE, smoke);
	smoke = NULL;
}