I've just started playing with particle systems/emitters and trying to figure how if there's a way to constrain (clip?) an emitter into the bounding box of a parent CCNode object..?
Constraining emitters/particle systems inside a parent node's bounding box?
(3 posts) (2 voices)-
Posted 1 year ago #
-
Turns out the answer was amazingly simple: Just use GL_SCISSOR_TEST/glScissor in your node's visit method to clip the particle emitter inside the node's bounding rect. E.g.:
- (void) visit
{
glEnable(GL_SCISSOR_TEST);
glScissor(_rect.origin.x, _rect.origin.y , _rect.size.width, _rect.size.height);
[super visit];
glDisable(GL_SCISSOR_TEST);
}Posted 8 months ago # -
I'm not sure I understand -- you create a node, then addChild the particle system to that node, then add that to parent? How do you handle removing it when the particle system is done? A more verbose example would be appreciated.
Posted 8 months ago #
Reply
You must log in to post.