From 46ac5d12b2c99ca6fc30a08472a88e4b871c5f8e Mon Sep 17 00:00:00 2001 From: wagulu Date: Wed, 23 Jul 2014 21:04:17 +0800 Subject: [PATCH 1/2] Update CCParticleSystem.cpp diff is base on WorldSpace, when you scale scene,you will get the wrong value. --- cocos/2d/CCParticleSystem.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cocos/2d/CCParticleSystem.cpp b/cocos/2d/CCParticleSystem.cpp index 25c1066098..917c6bf81d 100644 --- a/cocos/2d/CCParticleSystem.cpp +++ b/cocos/2d/CCParticleSystem.cpp @@ -771,7 +771,12 @@ void ParticleSystem::update(float dt) Vec2 newPos; - if (_positionType == PositionType::FREE || _positionType == PositionType::RELATIVE) + if (_positionType == PositionType::FREE) + { + Vec2 diff = converToNodeSpace(currentPosition) - convertToNodeSpace(p-> startPos); + newPos = p->pos - diff; + } + else if(_positionType == PositionType::RELATIVE) { Vec2 diff = currentPosition - p->startPos; newPos = p->pos - diff; From 2f10e8e468444019fbf3d10f1a2aec3364fbcbac Mon Sep 17 00:00:00 2001 From: LiuZhuo Date: Fri, 25 Jul 2014 11:40:23 +0800 Subject: [PATCH 2/2] Update CCParticleSystem.cpp --- cocos/2d/CCParticleSystem.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cocos/2d/CCParticleSystem.cpp b/cocos/2d/CCParticleSystem.cpp index 917c6bf81d..1dc57a04f2 100644 --- a/cocos/2d/CCParticleSystem.cpp +++ b/cocos/2d/CCParticleSystem.cpp @@ -773,7 +773,7 @@ void ParticleSystem::update(float dt) if (_positionType == PositionType::FREE) { - Vec2 diff = converToNodeSpace(currentPosition) - convertToNodeSpace(p-> startPos); + Vec2 diff = convertToNodeSpace(currentPosition) - convertToNodeSpace(p-> startPos); newPos = p->pos - diff; } else if(_positionType == PositionType::RELATIVE)