Allow particles when normal driving
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@7329 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
47add64448
commit
ffc6fd299c
@ -1560,7 +1560,7 @@ void Kart::updateGraphics(const Vec3& offset_xyz,
|
|||||||
|
|
||||||
if (material != NULL)
|
if (material != NULL)
|
||||||
{
|
{
|
||||||
if (m_skidding)
|
if (m_skidding > 1.0f)
|
||||||
{
|
{
|
||||||
const ParticleKind* pk = material->getParticlesWhen(Material::EMIT_ON_SKID);
|
const ParticleKind* pk = material->getParticlesWhen(Material::EMIT_ON_SKID);
|
||||||
if (pk != NULL)
|
if (pk != NULL)
|
||||||
@ -1590,10 +1590,32 @@ void Kart::updateGraphics(const Vec3& offset_xyz,
|
|||||||
const ParticleKind* pk = material->getParticlesWhen(Material::EMIT_ON_DRIVE);
|
const ParticleKind* pk = material->getParticlesWhen(Material::EMIT_ON_DRIVE);
|
||||||
if (pk != NULL)
|
if (pk != NULL)
|
||||||
{
|
{
|
||||||
|
//printf("Setting DRIVING particles\n");
|
||||||
m_terrain_particles->setParticleType(pk);
|
m_terrain_particles->setParticleType(pk);
|
||||||
|
|
||||||
|
m_wheel_toggle = 1 - m_wheel_toggle;
|
||||||
|
const btWheelInfo &wi = getVehicle()->getWheelInfo(2 + m_wheel_toggle);
|
||||||
|
Vec3 c = wi.m_raycastInfo.m_contactPointWS;
|
||||||
|
|
||||||
|
// FIXME: the X position is not yet always accurate.
|
||||||
|
m_terrain_particles->setPosition(core::vector3df(c.getX() + 0.06f * (m_wheel_toggle ? +1 : -1),
|
||||||
|
c.getY(),
|
||||||
|
c.getZ() + 0.06f));
|
||||||
|
|
||||||
|
const float speed = fabsf(getSpeed());
|
||||||
|
if (speed < 0.5f)
|
||||||
|
{
|
||||||
|
m_terrain_particles->setCreationRate(0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
float rate = (speed/m_kart_properties->getMaxSpeed());
|
||||||
|
m_terrain_particles->setCreationRate(pk->getMinRate() + rate*(pk->getMaxRate() - pk->getMinRate()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
//printf("No DRIVING particles\n");
|
||||||
m_terrain_particles->setCreationRate(0);
|
m_terrain_particles->setCreationRate(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user