aboutsummaryrefslogtreecommitdiffstats
path: root/src/declarative/particles
diff options
context:
space:
mode:
authorAlan Alpert <alan.alpert@nokia.com>2011-08-30 11:41:16 +1000
committerQt by Nokia <qt-info@nokia.com>2011-08-30 09:44:30 +0200
commitf6a312b76c221f4025a6a05b0bda02e55a8bd865 (patch)
tree872cb9d0a0dcf9aeb7ecfd9bc2bdd850beaa56ab /src/declarative/particles
parentf0eec8c2a4cac2e76ec90bde37f8ebc701896ce6 (diff)
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 <qt_sanity_bot@ovi.com> Reviewed-by: Alan Alpert <alan.alpert@nokia.com>
Diffstat (limited to 'src/declarative/particles')
-rw-r--r--src/declarative/particles/qsgpointattractor.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/declarative/particles/qsgpointattractor.cpp b/src/declarative/particles/qsgpointattractor.cpp
index 1a3c3c25c5..55b6cb67b7 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;