I am trying to make a mobile shooter, but the issue is the bullets are going in the direction of the mouse (as for PC), but I don't want it to be happen for mobile users as their mouse can't be locked in the center. Currently, I use :
local pos = (mouse.Hit.p - firepart.Position).Unit
Can I get to know any better version, in which bullets can go to center of the screen and not follow the mouse.
Any help would be appreciated!
I managed to solved the issue by myself, using lookVector
.
Try using a ViewportPointToRay/ScreenPointToRay: ViewportPointToRay You can easily use these to get the center of the camera and fire your rays from the center of that.
I used this in the past to create a nifty highlighter that fires a ray from the camera and uses the player's position to check distance. What I ended up with was a highlighter that can highlight anything the player can see that isn't tied to the viewpoint angle of the player's character (imagine a player zooming out their camera then trying to highlight an object behind another one).
If you do this, then just know if a player zooms their camera out and fires, they can potentially hit something behind cover. To solve this problem, make sure the camera is locked in place (no zooming in or out): CameraMaxZoomDistance