Set cursor position at the middle of the screen.
Hi guys. I'm trying to set my cursor's postion to the middle of the screen. I need it for my gun shooting script. But first, I found a System.Windows.Forms.dll on internet which should do it for me, but I don't know how to get this to work.
Yes, I've imported this file to my assets folder and i've gave the
using System.Windows.Forms;
on the start of my script. And know I don't know what to do next, can anyone help me with this? :)
Comment
Best Answer
Answer by SneakySquid · Jan 17, 2016 at 11:53 AM
I wouldn't recommend shooting from the mouse, unless you need to move the mouse to shoot away from the center of the screen.
If you are always going to be shooting from the center of the screen, use something like this.
RaycastHit hit;
if(Physics.Raycast (Camera.main.transform.position, Camera.main.transform.forward, out hit, 1000)){
}