[SOLVED] Layer architecture for FPS weapon?

Hi, I’m trying to make use of the layer system for rendering a FPS weapon “on top of everything else”, so the weapon doesn’t clip when the FPS player is near walls.

So for testing, my goal is: make the sphere render on top of everything else

I messed somewhat with the PlayCanvas layer editor, but I only have confusing results. E.g. I made a layer same as World layer and placed it in the Sublayers after World. Then I put the sphere into that new layer.

The result is: in editor its just rendered normally, in Play/Debug mode the sphere isn’t rendererd at all.

I guess I just don’t understand the layer system at all atm, somebody knows how to render something on top of everything else?

Edit: The reason I couldn’t see it in Play/Debug mode was that I forgot to add my new layer to the camera aswell. But still I can’t figure out how to render a model over everything else.

Edit 2: Ok, I just figured this out. The “secret” is to use a 2nd camera and set “ignore depth”. And put that camera into “MyFirstLayer”. In Sublayers, drag “MyFirstLayer” to the very bottom. That makes it render the sphere over everything else :slight_smile:

If anybody has a better idea for this, answer are of course still welcome

The layer system is to control the order that things are rendered. So I would have the weapon layer render after the world and disable z/depth testing on the materials for the weapon.

Here is a quick example: https://playcanvas.com/project/568932/overview/layer-demo-for-forums

Hm, yes, I first had that, setting entity.model.material.depthTest = false, but some of my models looked completely wrecked after setting it.

Looks like this then:

Switching cull mode didn’t “fix” this aswell

So I guess I gonna stay with the 2nd camera approach