Index Order with particles

Index Order with particles


Hi , I have a problem with the index of the render, I want a particle be behind the node but I need this particle be child of the oder node. I try with the index order script like;

var node = this.node
node.zIndex = 1;
cc.log("Node zIndex: " + node.zIndex);

what I an do?, thanks in andvance



If you want a particle to be behind the node, place the particle above the node from the Node Tree like this:


So I know it works, but I need you to be the player’s son and change the order in some way. I want you to follow the player and already I would like to know how to handle these situations through code.

I try other way and not works!

var child_Stack_Index = 3;
        var index = node.getSiblingIndex();
        cc.log("Node zIndex: " + index);


I also try directly with a instantiate prefab but anything…Render first the particle

       var scene = cc.director.getScene();
        var nodeS = cc.instantiate(this.sPrefab);
        this.node.addChild(nodeS, 0, "node");


Can you please elaborate why you want the particle to be the child of the other node?


Basically I want when a node has a child, the child node renders behind the parent, just that


is the Node Tree that you need?

the particle is in front of all things in editor

and it ran actually behind of the icon

If that is your wanted,you can refence this demo project (865.1 KB)


Exactly that, but it is by layers in the example, it serves me perfectly, thank you very much, but is there no way by zIndex? simply by having knowledge


for this node tree’s construction,zIndex can’t works.Only camera can help you to change the global rendering sequence.