mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-21 16:12:40 +08:00
Merge pull request #1686 from knoxHuang/v1.5
fix particleSystem error for fireball/issues/4943
This commit is contained in:
@@ -98,6 +98,22 @@ cc.pointApplyAffineTransform = function (point, transOrY, t) {
|
||||
return {x: t.a * x + t.c * y + t.tx, y: t.b * x + t.d * y + t.ty};
|
||||
};
|
||||
|
||||
cc._pointApplyAffineTransformIn = function (point, transOrY, transOrOut, out) {
|
||||
var x, y, t;
|
||||
if (out === undefined) {
|
||||
t = transOrY;
|
||||
x = point.x;
|
||||
y = point.y;
|
||||
out = transOrOut;
|
||||
} else {
|
||||
x = point;
|
||||
y = transOrY;
|
||||
t = transOrOut;
|
||||
}
|
||||
out.x = t.a * x + t.c * y + t.tx;
|
||||
out.y = t.b * x + t.d * y + t.ty;
|
||||
};
|
||||
|
||||
cc._pointApplyAffineTransform = function (x, y, t) { //it will remove.
|
||||
return cc.pointApplyAffineTransform(x, y, t);
|
||||
};
|
||||
|
||||
@@ -1673,6 +1673,7 @@ _ccsg.ParticleSystem = _ccsg.Node.extend({
|
||||
}
|
||||
this._particleIdx = 0;
|
||||
|
||||
var worldToNodeTransform = this.getWorldToNodeTransform();
|
||||
var currentPosition = cc.Particle.TemporaryPoints[0];
|
||||
if (this.positionType === _ccsg.ParticleSystem.Type.FREE) {
|
||||
cc.pIn(currentPosition, this.convertToWorldSpace(this._pointZeroForParticle));
|
||||
@@ -1760,9 +1761,12 @@ _ccsg.ParticleSystem = _ccsg.Node.extend({
|
||||
//
|
||||
var newPos = tpa;
|
||||
if (this.positionType === _ccsg.ParticleSystem.Type.FREE || this.positionType === _ccsg.ParticleSystem.Type.RELATIVE) {
|
||||
var diff = tpb;
|
||||
cc.pIn(diff, currentPosition);
|
||||
cc.pSubIn(diff, selParticle.startPos);
|
||||
var diff = tpb, localStartPos = tpc;
|
||||
// current Position convert To Node Space
|
||||
cc._pointApplyAffineTransformIn(currentPosition, worldToNodeTransform, diff);
|
||||
// start Position convert To Node Space
|
||||
cc._pointApplyAffineTransformIn(selParticle.startPos, worldToNodeTransform, localStartPos);
|
||||
cc.pSubIn(diff, localStartPos);
|
||||
|
||||
cc.pIn(newPos, selParticle.pos);
|
||||
cc.pSubIn(newPos, diff);
|
||||
|
||||
Reference in New Issue
Block a user