-
abhishekLikes 0Problem Description
Hi Sonar Systems,
I need help with implementing and controlling animation using ParticleSystem.
This is the code I am using to create an effect that creates stars on the screen when u simply touch the screen and move your finger around
myParticleSystem = ParticleFlower::create();
myParticleSystem->setTotalParticles(200);
this->addChild(myParticleSystem, 5);
myParticleSystem->setTangentialAccel(10.0);
myParticleSystem->setLife(3.0);
myParticleSystem->setPosition(location);
myParticleSystem->setTexture(Director::getInstance()->getTextureCache()->addImage("common/star.png"));
then in touchMoved i simply write this code:
Point location = touch->getLocation();
myParticleSystem->setPosition(location);
So everything works perfect this way.
I get a beautiful star animation that makes you feel that stars are being released as you move your hand around on the screen.
THE PROBLEM:
In order to get the same effect on Full HD devices, I only add one extra line.
Adding this line makes the stars look bigger on Full HD screens. If I dont add this line, the stars are very tiny and i dont get the problem that i am about to mention.
myParticleSystem->setScale(2.0);
So when I add the above line, the stars become big and clearly visible.
But then the ParticleSystem animation behaves in a very weird way.
Instead of naturally following the opposite direction, the stars act in a mechanical way.
I have sent you videos of the same at support@sonarsystems.co.uk
I need the scale 2.0 part (the device i used for capturing video was not full HD)
Please check them out and help me with this.
I have no idea why this is happening.
Thanks
-
Sonar Systems adminLikes 0
I couldn’t really see an issue, could you record a couple more videos but use the exact same animal for both and move your finger the same so we can compare again.
-
abhishekLikes 1
let me tell you the issue..
In video 1 (NORMAL MODE), once the stars are emitted, they are independent of where i am touching or dragging..
the stars have nothing to do with where my finger is currently..
BUT in video 2 (SCALE MODE),
When i move my finger down.. ALL STARS GO UP
When i move my finger to the right.. ALL STARS GO LEFT
When i move my finger to the left.. ALL STARS GO RIGHT
When i move my finger upwards.. ALL STARS GO DOWN
does this help?
have you got the problem now?
IN VIDEO 1, the stars DONT CHANGE THEIR POSITION when i move my finger..
IN VIDEO 2, the star positions are directly affected by the direction in which i move my finger..This reply has been verified.
-
Sonar Systems adminLikes 0
Try setting the scale to something custom on the smaller screen size to see how it reacts but I do see the issue now.
-
abhishekLikes 0
yes i have tried that..
as soon as i change the scale from 1.0 (the default value) to anything else, i get the same problem !!
the stars stars moving in the opposite direction
:(
-
Sonar Systems adminLikes 0
Try scaling everything so multiply everything you set by 2 as well
-
abhishekLikes 0
yes i have tried that as well..
in these 2 lines of code:
myParticleSystem->setTangentialAccel(10.0);
myParticleSystem->setLife(3.0);
i tried setting TangentialAccel to 1.0, 2.0, 5.0, 20.0, 50.0 etc
i tried setting Life to 1.0, 5.0, 10.0 etc
i still get the same problem
-
Sonar Systems adminLikes 0
Have you tried it on different even larger or smaller devices.
Login to reply