From 43dcef7968d507328c130aeeb64d25bb6ac3cf92 Mon Sep 17 00:00:00 2001 From: auria Date: Sat, 10 Sep 2011 18:25:21 +0000 Subject: [PATCH] Fixed bug with particles being emitted at (0,0,0) git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@9789 178a84e3-b1eb-0310-8ba1-8eac791a3b58 --- src/karts/kart.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/karts/kart.cpp b/src/karts/kart.cpp index d8e55656c..7ecb39599 100644 --- a/src/karts/kart.cpp +++ b/src/karts/kart.cpp @@ -1122,11 +1122,12 @@ void Kart::handleMaterialGFX() const btWheelInfo &wi = getVehicle()->getWheelInfo(2 + m_wheel_toggle); xyz = wi.m_raycastInfo.m_contactPointWS; + // FIXME: the X position is not yet always accurate. xyz += Vec3(0.06f * (m_wheel_toggle ? +1 : -1), 0, 0.06f); - m_terrain_particles->setPosition(xyz.toIrrVector()); + // Get the appropriate particle data depending on // wether the kart is skidding or driving. const ParticleKind* pk = @@ -1160,6 +1161,11 @@ void Kart::handleMaterialGFX() float create = pk->getMinRate()*(1-rate) + pk->getMaxRate()*rate; m_terrain_particles->setParticleType(pk); + + // when particle type changes, the emitter is re-created at (0,0,0) so we need to + // set the position after setParticleType + m_terrain_particles->setPosition(xyz); + m_terrain_particles->setCreationRate(create); }