0

I want to create a fire particle system on a sprite when its hit by another sprite:

void MySprite::hit() { auto ps = cocos2d::ParticleFire::create(); ps->setPositionType(cocos2d::ParticleSystem::PositionType::RELATIVE); this->addChild(ps); } 

I use 'setPosition3D' and 'lookAt' methods for moveing camera in the scene. when i move camera, the particle system stuck in the screen (and always has a fixed position in the window) and dont follow the parent sprite!

I try different position type, Follow action, setSourcePosition method, but the problem not solved.

I use cocos2d-x v3.3 and C++ in Visual Studio 2013.

1 Answer 1

0

I solved the problem.

I used two camera, one for HUD (CameraFlag::DEFAULT) and another for the scene (CameraFlag::USER1). i forgot to set camera flag for particle system:

ps->setCameraMask(cocos2d::CameraFlag::USER1); 

and particle system shown by default camera.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.