- Home /
have object rotate to the mouses screen position
Is there a way to have an object look towards the mouses position on the screen, such as a head turning towards wherever the mouse happens to be on the screen, not in actual worldspace, I have found lots of mouse look scripts but they rotate towards the exact position in world space not its position on the screen.
Answer by Joshua · Apr 12, 2011 at 08:52 PM
Take the x position of the mouse on the screen (like so)
Take the screen width (like so)
Take the width/2 - x position of the mouse to get how far left/right of the center it is.
rotate the wanted object by that amount * however much you'd wish (like so)
Now do the same for height/y.
Good luck with it.
Your answer
Follow this Question
Related Questions
MouseY always enabled? 3 Answers
Mouse movement swings character around in circles 1 Answer
Baffling Input.Mouseposition problem. If statement not correctly working. 1 Answer
How to Move a Cube 3 Answers