Performance difference between custom and mouse raycasts

I have a simple question, is mouse.Target more performant than using camera:ScreenPointToRay? And are there any more performant alternatives to raycast from mouses position on screen?

Using the cameras lookvector multiplied by the raycast range is a good alternative to using the mouse, but this works best in first person games, where rays are required to go straight forward.

As for the first question, im not too sure as i havent used camera:ScreenPointToRay.

However, it may be better to use the mouse because im not 100% sure if camera:ScreenPointToRay can have a raycast blacklist (Again though, i havent used it before)

Edit:
Going to add on here, by creating RayParams I havent had any kind of performance loss, even on really old computers.

1 Like

I’m almost certain they use the same underlying system and thus have the same performance. There are some instances where you can avoid raycasting because of your specific application but I’d have to know more about what you’re doing.

1 Like