- Home /
Reset the mouse cursor at center of screen by spring
Hello everyone,
I'm currently creating a FPS spaceship where you're piloting your ship only whith the mouse for the directions. Actually the sight for shooting is Locked on center (see screenshot), but I would like to give it some freedom on the screen to shoot enemies. So the part that causing issues is that I would like to move on the screen, but with a sort of "spring" back to the center when static.
If anyone see how I can achieve that ?
Thank's
Antoine
Answer by TexusDark · Jul 17, 2017 at 04:42 PM
Hello.
Try to test with Cursor.lockState
You have the documentation about this here : Cursor.lockState
Thanks TexusDark, but I know about Cursor Lockstate. Actualy is locked but if Contrained it's not what I want too.
The thing is to reset cursor on center on the screen depending of where the mouse was before :)
Try this :
if(//what you need) { Cursor.lockState = CursorLock$$anonymous$$ode.Locked; Cursor.lockState = CursorLock$$anonymous$$ode.None; }
Oh ! Thanks I understand the concept ! It's a little brutal however... Can I do a Lerp between differents Cursor.lockState ?
Your answer
Follow this Question
Related Questions
trespasser arm 0 Answers
Making a torque-based sphere controller by simple mouse inputs 2 Answers
Bullet mouse control 2 Answers
Inconsistent Mouse Related Behavior in 2D 1 Answer
The name 'Joystick' does not denote a valid type ('not found') 2 Answers