0
\$\begingroup\$

I'm working on a twin stick shooter where the player looks at the mouse cursor. Like most I use the absolute mouse position and the player's position to determine the direction and derive an angle. This works great. However I recently discovered WM_INPUT which allows you to take advantage of higher DPI mouse movements, the values it provides are relative so a 'look at' type of solution does not work anymore.

Simply rotating the player based on a single axis does not feel right, since if you keep scrolling left the player would eventually rotate 360 degrees. I also tried to accumulate and scale the relative mouse movements and clamp them to -1 through 1 like gamepad thumb values, this works alright but feels a bit limiting in terms of full use of the higher sensitivity.

Does anyone have any insights into implementing top down player rotation using relative mouse movements?

\$\endgroup\$
3
  • \$\begingroup\$ Can you just use a virtual cursor object and use the relative movement to move the virtual cursor? \$\endgroup\$ Commented Jun 28, 2022 at 0:05
  • \$\begingroup\$ I tried this, however a virtual cursor needs to be visible for it to feel right. It falls apart once the distance from the player gets too large. Is there a solution for that? Clamping feels wrong. \$\endgroup\$ Commented Jun 28, 2022 at 19:33
  • \$\begingroup\$ You can display a graphic at the virtual cursor position. Clamping the virtual cursor inside the screen/window boundaries seems like a perfectly acceptable solution to me. \$\endgroup\$ Commented Jun 30, 2022 at 19:27

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.