Cant make floor invisible without losing camera collision

I want to sometimes load a floor mesh that does not render anything but still collides with the camera. At first I thought just use a PNG texture with full alpha=0 for transparency. But it still renders something. We figure it’s a light/shadow issue.

So I added the mesh to all of my lights’ mesh exclusion lists. Here’s where it gets weird. Despite having 4 lights (2 dir, 2 hemi), if I add the floor to even one light’s exclusion list, the floor disappears completely - including lack of camera collision.

Ive also tried:

disabling the material on the mesh (it still renders some kind of default grey plane with specularity),

setting mesh.visibility=0 (visually it works, but it also disables camera collision)

Functionally, we always want a floor at z=0 whether there’s a visual component or not, I just want the floor invisible in certain cases.

What am I doing wrong?

EDIT: I did just find a kind of solution. Set the ground mesh material disableColorWrite=true. But that seems an awkward way of doing it.

I believe that ground.visibility = 0 should solve your issue.
It doesn’t disable camera collisions.
Example - https://playground.babylonjs.com/#4HUQQ#2573

1 Like

Well hell. Now visibility=0 works? I guess it was probably working before and I visually fooled myself. LOL. I should probably just delete this thread and we’ll pretend Im not an idiot.

2 Likes