Alternative to mouse.Hit.Position for guns?

I’m making a gun system and I’ve recently heard that mouse.Hit.Position is inaccurate and should not be used, I also have experienced issues using this. So what are some simple but up-to-date alternatives? (Preferably uses Vector3)

Are you using mouse.Hit.Position for raycasting, or are you launching a bullet to that Position and using a .Touched event for the bullet?

There are a few variables that are going to affect how your gun works.

1 Like

So after using cameraScreenPoint to ray, I found out that it actually has origin and direction properties which make it easier for me to incorporate it into my script

	local ray = Workspace.CurrentCamera:ViewportPointToRay(mouseLocation.X, mouseLocation.Y)
	ray.Origin

Gonna mark this as solution for now

2 Likes

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