Help with creating an optic that shows a reticle at the front of a barrel

[I do not know what this goes under since i do not know if i need to script or creating UIfor this]

Hello everyone,
I need help creating a reticle that is not like the standard decals stuck to the front of a optic, something like this
image

It’s not visible anywhere but through the optic [im thinking viewportframe but after looking through a few forums im not thinking its the best solution]
image

Are you able to give a script example or the different components on how to make this?
thank you

1 Like

raycasting will help.

try look:

1 Like

I already know raycasting is apart of it, but how would i use it in this case? Do i shoot towards the direction of the retical and if it hits the optic, im not sure

You can simply just cast a ray from the camera to the reticle, and if the ray collides with the optic, you make the reticle visible.

1 Like

Thank you, it works perfectly now.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.