From 8a3b74a951a636d624fa24613bc8f743ce2797cb Mon Sep 17 00:00:00 2001 From: auria Date: Sat, 8 Jan 2011 01:49:10 +0000 Subject: [PATCH] Fix smoke particles to not hardcode rate git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@7330 178a84e3-b1eb-0310-8ba1-8eac791a3b58 --- data/smoke.xml | 6 +++--- src/karts/kart.cpp | 31 ++++++++++++++++++------------- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/data/smoke.xml b/data/smoke.xml index b7637bfbf..7c804907a 100644 --- a/data/smoke.xml +++ b/data/smoke.xml @@ -10,9 +10,9 @@ - - + + diff --git a/src/karts/kart.cpp b/src/karts/kart.cpp index 1a3657562..ade113b2a 100644 --- a/src/karts/kart.cpp +++ b/src/karts/kart.cpp @@ -1555,7 +1555,6 @@ void Kart::updateGraphics(const Vec3& offset_xyz, if (m_terrain_particles) { - float f = 0.0f; const Material* material = getMaterial(); if (material != NULL) @@ -1567,18 +1566,24 @@ void Kart::updateGraphics(const Vec3& offset_xyz, { m_terrain_particles->setParticleType(pk); - if (fabsf(m_controls.m_steer) > 0.8 && isOnGround()) f = 250.0f; - - m_terrain_particles->setCreationRate((m_skidding-1)*f); - - 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)); + if (fabsf(m_controls.m_steer) > 0.8 && isOnGround()) + { + float rate = m_skidding - 1; + m_terrain_particles->setCreationRate(pk->getMinRate() + rate*(pk->getMaxRate() - pk->getMinRate())); + + 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)); + } + else + { + m_terrain_particles->setCreationRate(0.0f); + } } else {