I currently have a sprite that is attached to a physics body . (The physics body presence draws a circle around the sprite ). Now if the following action is applied to the sprite while an impulse is being applied to the physics body I would sometimes see the circle (physics body) around the sprite but the sprite inside it would disappear. What is happening is that the physics body moves away from the sprite. (i.e) The physics body moves because of the impulse but for some reason the fails to move the sprite along with it
void Hero::BulletHit()
{
Action* act = Blink::create(1, 5);
this->sprite->runAction(act);
}
Any suggestions on why this might be happening or how I might fix this ?
My problem seems to be like this one here
http://discuss.cocos2d-x.org/t/bug-in-physics-cocos2d-x-3-0-beta-2/11565/3
The only difference is that the OP of that thread is moving the sprite with a physics body using
this->setPositionX(getPositionX()-509*dt);
However I am moving my sprite using
sprite->getPhysicsBody()->applyImpulse(ForceVector);
I believe this issue is because while the body is moving I am applying the action
void Hero::BulletHit()
{
Action* act = Blink::create(1, 5);
this->sprite->runAction(act);
}
Suggestions ? Is there any way for my to apply the action without having the physics body loose the sprite that it encloses ?