Problem in Shooting projectiles while moving

The Projectile should spawn/start at the yellow box.
yellowbox is a child of the weapon, and the weapon is the child of the spaceship.

Projectile->setPosition(weaponBody->convertToWorldSpace(yellow_target->getPosition()));

but when spaceship moves at different position (x,y) yellow box’s position does not update/change

when ship moves up

if i understand your problem correctly then Projectile->setPosition(this->convertToNodeSpace(yellow_target->getPosition()));
will get you desired result, where this is your scene/ layer where spaceship is added.

Hi,

this is my structure

this
spriteLayer
weaponBody
yellow_target