From: Alan Alpert Date: Tue, 30 Aug 2011 01:41:16 +0000 (+1000) Subject: Fix Attractor affector X-Git-Tag: qt-v5.0.0-alpha1~1852 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f6a312b76c221f4025a6a05b0bda02e55a8bd865;p=profile%2Fivi%2Fqtdeclarative.git Fix Attractor affector Wasn't simulating the physics right, interacted wrong with other attractors when in Velocity mode. Change-Id: I5883eb748b398494ad552e35f06d1167da6023a6 Reviewed-on: http://codereview.qt.nokia.com/3835 Reviewed-by: Qt Sanity Bot Reviewed-by: Alan Alpert --- diff --git a/src/declarative/particles/qsgpointattractor.cpp b/src/declarative/particles/qsgpointattractor.cpp index 1a3c3c2..55b6cb6 100644 --- a/src/declarative/particles/qsgpointattractor.cpp +++ b/src/declarative/particles/qsgpointattractor.cpp @@ -80,6 +80,7 @@ bool QSGPointAttractorAffector::affectParticle(QSGParticleData *d, qreal dt) } dx = ds * cos(theta); dy = ds * sin(theta); + qreal vx,vy; switch (m_physics){ case Position: d->x = (d->x + dx); @@ -91,8 +92,10 @@ bool QSGPointAttractorAffector::affectParticle(QSGParticleData *d, qreal dt) break; case Velocity: //also default default: - d->setInstantaneousVX(d->vx + dx); - d->setInstantaneousVY(d->vy + dy); + vx = d->curVX(); + vy = d->curVY(); + d->setInstantaneousVX(vx + dx); + d->setInstantaneousVY(vy + dy); } return true;