Layer mask with model?

Hey, I am planing on making an fps with babylon.js, and found a solution to viewmodel clipping. I found THIS and wondered if it was possible with 3d models. The reason I would like to do this is to prevent something like this from happening:
com-optimize

I used krunker.io as an example with the shotgun class. see how the gun and arms go in the wall?
That is what I’m trying to eliminate.

Thanks for any help!

PS: the game is so unfinished so no demo can be showed.

1 Like

First your game looks gorgeous! Can’t wait to see it

You can try that: myGun.renderingGroupId = 1

2 Likes

I’m flattered, but it’s not my game. Its krunker.io. I used it as an example. The player model inside of the wall is what I’m trying to combat. In the document’s playground, the crosshair is always on screen, never covered up. If I use a 3d model(like a viewmodel) like the crosshair, the model/gun will NEVER go inside walls. Is there any way to do this(the document said that lights were masked out so the crosshair would be only emissive) I would love the help.

Thanks for the flattery, Givo.

Did you try with renderingGroupId?

after some experimenting, I (stupidly) found that the crosshair is just a bunch of misshaped cubes.

Here is a playground: https://www.babylonjs-playground.com/index.html#2GXKNW#39

I modified a cube to make an “arm.” now I’m gonna experiment with making a 3d model that can be put in the place as the cube.

2 Likes