Jump to content

How to map a range from [-1, 1] to 360 degrees?

Recommended Posts

Hey there,

 So I've snagged onto a little problem while developing my game. 

I'm using Phaser with it's inbuilt support of gamepad. 

The axis of the controller input works in a way such that it returns 1 when held to the right and -1 when held to the left. Here's a picture to make things easier to understand.



How would I map the values to degrees? Here's a visual representation of what I'd like to get.



What's a formula that would allow me to do this?

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...