Mouse.Hit different on XBOX and mobile?

Hey guys, I have a question:

I’m making a gun script, and I need to know where the mouse hits so I can direct the bullet to that spot. My script is also controller and mobile compatible, but on xbox, the cursor floats a bit higher than on pc. On mobile, there can be multiple cursors. Does anyone know how to handle this? The cursor is Lock Center, but I’m not sure if it will work despite this.

1 Like

If you want the aim to be directly in the center of the screen(mouse locked) then use ScreenPointToRay. If you want to allow the cursor to move around this is rather difficult because PC players can move their mouse, xbox players can’t, and mobile users and just tap to fire which is a little unfair. If you are locking the mouse to center, I’d suggest having a “Fire” button for mobile users to hit since that seems to be the cleanest way to support it.

6 Likes

That’s what I was looking for! I didn’t know SceenPointToRay was a thing (I should’ve though because they have Vector to Screen point so it would only make sense.) And yes, the mouse is locked in the center. Thanks