How to detect how much was mouse moved only horizontaly?
Hi all.
Basic Information
I need to know how much player moved with mouse but not matter on position because it will be ignored when cursor reach edge of monitor (because cursor move not farther/ don't change position).I need something based on speed of mouse.
More details
I making 2D top-down hack'n'slash space shooter game where player piloting a spaceship. Camera rotate to match rotation of player spaceship (it mean rotate spaceship to cursor is bad idea). I need to know how much player horizontaly moved with mouse (both positive and negative value) to add it to player's spaceship Z rotation and make him rotate. I alredy have code to rotate ship by angle i just need to get angle to move (calkulation of angle : transform.rotation.eulerAngles.z + mouseMovedDistance
).
Thanks
-Garrom
Answer by merkaba48 · Jun 02, 2017 at 07:07 PM
Play around with the result of the method Input.GetAxisRaw("Mouse X"), that might be what you're looking for.
Your answer
Follow this Question
Related Questions
Mouse Input for Build Mode Windows are switched 0 Answers
Rotate Cube Depending On Where The Cursor Is 1 Answer
How do i get my character to move in the direction it is facing with a vector 2 map 0 Answers
How to make the GUI Buttons consistent in screen while the background screen is rotatable? 0 Answers
Detect mouse inputs when the scene is changing to another scene. 2 Answers