Render lines behind sprite

I have tried adding a layer to the renderLine options, but the lines are always infront of my transparent sprite. Sprite is on world layer. Even re-ordering the layers in project settings doesn’t do anything, other than coloring the rendered lines slightly.

Can you post your project please?

Here is the project overview: https://playcanvas.com/project/732529/overview/lines-render-ontop-of-sprite

I have even placed the sprite in front of the drawn lines, but they are still drawn on top.

Hmm, interesting, it seems to work find with regular world models, they do render in front of the lines but sprites don’t.

Even adding the sprite on a UI Screen doesn’t seem to solve this. Try raising an issue about it in the engine repo in case it’s a bug.

Looked at this and spoke to the team.

renderLines was meant to be a debug feature (we should update the JSDocs to reflect that) so it’s unlikely that we will fix this soon (and chances are that we will replace this with something more fully featured).

The recommendation is to use the pc.Mesh API (example here http://playcanvas.github.io/#graphics/mesh-generation.html) and instead of triangles, use lines instead.

We will look at creating an example that does lines/grid.

Can you give an example of making a mesh that is just lines? I’m not sure that I follow. Do you mean create a mesh with just 2 points, and if so that will be visible?

We have an issue to make specific example for lines if you would like to subscribe. Not sure when we get a chance to make a proper example though.

@machineman1357 This is not a proper example but more for me to mess about with. Hopefully this will help get you started: https://playcanvas.com/editor/scene/1023589

1 Like