Laymask with loaded model

Hey again.

After my realization on the old thread (same topic, stupid solution, not recommended) I decided to make a new one, but with the same purpose. In THIS playground I have a box and sphere, both layermask = 0x20000000; are always in the camera’s view. I also have the animated “guy” model. also layermask = 0x20000000;. The only thing is is that the guy is not always in the camera’s view. Any help would be nice.

Thanks for any help, the dead thread copier guy.

I have tried adjusting some of the conditions, but nothing has worked. Hey @Deltakosh @Wingnut any ideas?

Sorry but what is the question ? :smiley:

1 Like

Remember my old post on this? https://forum.babylonjs.com/t/layer-mask-with-model/1374.

I came back to it and I really want to figure it out. THIS playground has the “arm” and a sphere. notice how I added the sphere. I did the same thing to the guy, but he doesn’t show up. The end result I would like to have is something like THIS. All i did was remove the layer mask from the sphere and camera. You can see the sphere under the other one, and see the guy, but you can see the other objects. Removing the layer mask is something that I would be willing to do, but only if nothing can be figured out.

Thanks for any help!

The dead thread necromancer.

Hi G!

I’m still experimenting, but at-minimum, you need to down-scale that big dude.

guy.scaling = new BABYLON.Vector3(.03, .03, .03);

Is that enough to get you rolling again?

I’m working on something with a different format… but… still needs work/play.
https://www.babylonjs-playground.com/#2GXKNW#46

Did you see my other playground? I like your demo(even if it is only a WIP).

If no solution is found, a nice easter egg could be the viewmodels.:grin:

Dude is the player, isn’t it? At first, I was thinking dude is the target to be shot. :slight_smile:

Dude is the target to be shot. Technically, it isn’t but I use gitlab and can’t load custom 3d models. Layer mask doesn’t work with 3d models so I used dude as an example. He should be seen at all times. In the end guy would actually be replaced with a viewmodel.

1 Like

I guess the problem is that you assume that dude has only one mesh but actually it contains 5:
image

Wow DK, we’re both late-nighting the same issue. :slight_smile:

I just finished a MUCH MORE simple version… without layerMasks, without merging… without lots of crap.

https://www.babylonjs-playground.com/#2GXKNW#52

I’m wondering if Givo will be happy with it. Maybe. (fingers crossed)

And yes, in an earlier version, I had to iterate thru all newMeshes, setting a layerMask on each.

I’m not sure why layerMasks were needed. Maybe to avoid gun overlapping ground when player/camera gets too near? hmm.

I’m wondering if Givo will be happy with it. Maybe. (fingers crossed)

Dun Dun DUUUUUUUUUUUUUUUUUUUUUUUUUUUUUN. (I dramatically walk into the room) What do you mean, MAYBE.:

JK I like to have fun.

(Sees playground) What trickery IS this!?!?!?:flushed::flushed::flushed::flushed:

Wingnut, I like that solution. like a lot. And yes, the layerMasks were needed to prevent the gun clipping into a wall or something. Like this(game demoed here is Krunker.io. Has the gun-clipping issue):

Thanks for the help!!!
(game demo will come out before april. No promises.

2 Likes