From 9836222a00028cc9a3aea9bb4c316a00b59ea33a Mon Sep 17 00:00:00 2001 From: Philipp Sehmisch Date: Wed, 27 Jun 2007 23:26:01 +0000 Subject: Corrected some perspective issues of the particle engine and fixed a crash caused by particles with child emitters that have an image than isn't used elsewhere. Added a particle effect at the spawn point in Tulimshar (we should have at least one particle effect that demonstrates acceleration and particles with emitters) --- src/particle.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/particle.cpp') diff --git a/src/particle.cpp b/src/particle.cpp index 509c20ee..805da102 100644 --- a/src/particle.cpp +++ b/src/particle.cpp @@ -39,6 +39,8 @@ #include "utils/fastsqrt.h" #include "utils/xml.h" +#define SIN45 0.707106781f + class Graphics; class Image; @@ -122,7 +124,7 @@ Particle::update() if (mTarget && mAcceleration != 0.0f) { - float distX = mPosX - mTarget->getPosX(); + float distX = (mPosX - mTarget->getPosX()) * SIN45; float distY = mPosY - mTarget->getPosY(); float distZ = mPosZ - mTarget->getPosZ(); float invHypotenuse; @@ -167,8 +169,8 @@ Particle::update() // Update position mPosX += mVectorX; - mPosY += mVectorY; - mPosZ += mVectorZ; + mPosY += mVectorY * SIN45; + mPosZ += mVectorZ * SIN45; // Update other stuff if (mLifetimeLeft > 0) -- cgit v1.2.3-70-g09d2