Is there any way to make a decal only show behind a certain part and become invisible if it isn't behind a part?

I’ll try to showcase what I want to do:

I don’t know if this requires any scripting. I just want to find a way to make a “realistic” reticle of sorts.

This is what it should look like if its only slightly visible (edited picture)
The only game I know that have done this exact thing is Breakify’s Gun Test Place.

Any possible way to recreate this? Thanks!

If you’re trying to create a holographic sight you could do that with a surface gui. You need to place the reticle within the GUI such that it appears to be at the imaginary position of the reticle, i.e. in the focal plane.

edit: sorry surface GUI not billboard.

1 Like

Is this what you’re going for?

edit: updated to fix a math error

1 Like

I will look at it tomorrow, it’s late here. Thanks for practically spoonfeeding me.

1 Like

The script you made is basically a lag bomb. It spawns 3 spheres for god knows what reason and updates the camera every single frame, even while standing still. Yes, it is what I’m looking for. But it impacts the performance a ton. It also looks choppy in general. But I can work with your code and try to make a better version. Thanks!

You’re going to have to actually read the script and figure out why that is. The performance is probably cause by you having the output window open, which lags if you print the same thing over and over, which will happen if you stand still and didn’t remove the debug print, because of the stupid way the output window stacks messages.

1 Like

Is there any way to make it less choppy? And maybe make it stay in the same position (center, and no where else)? I don’t want you to spoonfeed me for your sake.

It wouldn’t be a holographic effect if it stayed in the center.

1 Like

Only video I could find showcasing what I mean.

I’m not sure what you mean by this. You can change the focalPlane variable to adjust how far the reticle appears. In that video the airsoft one has a closer focal plane setting.

1 Like

Do you see how the optic is standing still in the same position adjacent to the barrel? I want to make it look like that.
This is what happens when you move your camera a few times (I don’t want it to behave like that)

Thats what a holographic sight does though. Do you just want a plain sight?

1 Like

If it works like how I described, yes. I’m really bad at describing optics.

Delete the script and the reticle will just stay still.

1 Like

But that defeats the point of my entire topic.

If you want a plain sight then the dot will always be on the surface of the glass which means it will always be visible if you can see the glass, so you don’t need what you’re asking for in that case.

1 Like

I did delete the script, it just acted as a regular decal. I already showed what I mean.
Here’s another visualisation

How it should look when its directly ahead

How it should look when its slightly to the right
See how the reticle is standing in place?

That is what the script does, can you show a video? Maybe its not working for some reason.

1 Like

I have to use the default ROBLOX recorder because the recorder I’m using breaks whenever I record in studio. If you can’t see anything I’ll try my best to record it on my default recorder.

I mean the one that I gave you. What you posted also works the same, except the dot is slightly laggy.