How to stop the camera from going through a semi-transparent part?

I made a building in Blender that has windows. The windows are flat planes combined into one mesh, have 0.85 transparency and their material is SmoothPlastic. They have CanCollide and CanTouch enabled. For some reason the camera can go through them. How do I stop it from doing that?

Have you tried extruding the planes a little thicker, also testing with a normal part?
Does it behave the same way with the same properties?

I’m guessing @GrenadeNade is correct, your panes of glass are just too thin to register.
A simple way of fixing this, especially if you have multiple windows is to put 1 single Part in a wall that’s the same outer size of the wall and is CanCollide true and not Tranparent. Put a BlockMesh inside it, and set the scale to .001,.001,.001. If this puts the visible BlockMesh inside a window you can just use the Offset of the BlockMesh to move it back int the visible wall.
You can also make all the other wall Parts CanCollide and CanTouch false because the BlockMesh Part covers that.

1 Like

I extruded the windows and the camera still passes through them. I made a block with the same properties (SmoothPlastic, 0.85 transparency) and the camera passes through it too.

this seems to happen with anything that has a transparency lower than 0.2

to get around this maybe use a mesh part with slightly inverted normals. you should be able to see through them, make sure double sided is unchecked

Clone your window, transparency 0, insert a blockmesh, scale = 0,0,0

2 Likes

Don’t even need to do that. Check my post.
@Miserable_Haven the issue with that is the window he has appears to be too thin. If he has multiple windows in a wall that’s one flat plane my suggestion makes the entire wall 1 Part so it’s the only one that has to have collision.
Your way works for individual windows if he makes the window 10 times thicker (or whatever he decides), with a BlockMesh, and only changes the thickness axis Scale to .1 (or whatever makes it appear the original thickness.

false. the camera will clip through any block with a transparency higher than 0.2 (I checked)

my method could also work for a wall of windows

however, I do think your method would also work… Im just not quite sure how.

image
you can run the game and then copy the player module in StarterPlayer > StarterPlayerScripts, then stop it and paste it back into starter player scripts so it saves, then find line 129 in the popper script and comment it out so your camera doesn’t go through anything transparent
image

4 Likes

I’ve used the tiny Scale BlockMesh trick ever since I found out about it a couple years back.

1 Like

This is a neat solution. It works like a charm! And it doesn’t interfere with my game; I don’t want all transparent parts to behave this way, only certain windows. Even AI assistant didn’t know about this solution, it told me it was impossible without editing or replacing core scripts. Thanks!