MoveTo action not smooth

Hi,
I just create a MoveTo action using cocos2d-x V3.0, and i noticed that isn’t smooth(jumpy),and the sprite will be not clear until reach the destination.
The MoveTo code

void Piece::moveTo(cocos2d::Vec2 position , float duration) {
auto move = MoveTo::create(duration, position);
this->runAction(move);
}

Could you explain to me, why this happen ?
Thanks.

Actions are based on time.
So if framerate is not stable, it may not look smooth.

Let’s assume you made a MoveTo that should be finished 1 second.
It should be finished in 1 second.
And for this situation, let’s assume each frames are rendered in
0.1s, 0.1s, 0.1s, 0.1s, 0.1s, 0.1s, 0.1s, 0.1s, 0.1s, 0.1s.
then it looks like smooth.
but how about in 0.1s, 0.1s, 0.1s, 0.3s, 0.1s, 0.1s, 0.1s, 0.1s?
first 3 frames are looks like smooth.
But at 4th frame, sprite should be positioned at 0.6s.
At this point, you feel jumpy.

otherwise, MoveTo action will not be finished in 1s. it will take more time.

Thanks, so there’s no solution ?
Also it heppen when i move a sprite using

  void Piece::onTouchMoved(cocos2d::Touch *touch, cocos2d::Event *event) {
    if (this->_actived)
    {
       
        this->setPosition(Vec2(this->getPositionX()+touch->getDelta().x, this->getPositionY()+touch->getDelta().y));
       
     }
}

What are you testing this on?

On two devices: ipad mini and ipad air.

That is really weird, could you post the MoveTo code you are using please.

I updated my question.

I assume Piece is a node of some sort?

its subclass of sprite

ok, when your moving it how far are you trying to move it and over what duration?

for example in the ipad air i move it along 2000 px in 1 second

Have you just tried moving a sprite in a scene on its own to see if that is smooth.

Yes, it’s the same thing.

Is the image for the sprite immensely high res, what is the frame rate?

No, the image resolution it’s medium, frame rate it’s between 57 fps and 61 fps( not stable)

I was getting tons of movement stutter after creating 9000 near identical sprites in an attempt to emulate particle effects, most were kept off screen most of the time but their mere existence was felt to be a problem.
I ended up recycling (repeating) them instead. I still had stutter even with about 100 or 200, even in signed build.
Eventually it is working smoothly again. I think turning off debugging flags might have helped. This was using a spriteBatchNode.
It should work, given, cpp-tests as reference, but I had (one or ten) other things on screen to perhaps afflict the spriteBatchNode. What I learnt was that spriteBatchNode was no panacea for sloppy programming. Not that that’s what your doing. Just my recent experience.

Thanks, but how to turning off debugging flags ?

did you do nothing while sprite is moving?
like, create some sprites more or something?

@yagoub in Android or application ( i forget which). mk in jni folder, set the -DCOCOS-DEBUG=1 to 0