Sign in to follow this  
bzroom

Mapping unit circle to rectangle (gamepad stick input)

Recommended Posts

When mapping a gamepad stick to XY controls, such a for a vehicle (steering/throttle) you lose a bit of control in the corners. You can't have full steer and full throttle. I'm curious what people do to fix this problem. I was thinking of taking the X value raw, and the computing the Y value in terms of the maximum possible Y value for the given X. This sounds kind of unstable though, at full X stick the maximum Y value is zero, or very close to it. This will make any slight Y movement twitch from 0 to full + or - Y.

Share this post


Link to post
Share on other sites
Most racing games use a different button for "accelerate" and "brake". The left analog stick is just for steering. On the Xbox controller, you can use the trigger buttons for accelerate if you want to provide an "analog" acceleration button (otherwise, most of them use "X").

Share this post


Link to post
Share on other sites
I agree, usually i'd use separate controls, probably the triggers. But this is for basic movement. Not realistic racing movement. So like say it where controlling a character. How would one remove the dead spots in the corners?

Share this post


Link to post
Share on other sites
I imagine then it's based on angle/distance, where the angle is which direction to move in and the distance (amount of tilt in the analog stick) is the speed. That's how it feels with most 3rd person games which use such a control scheme.

Share this post


Link to post
Share on other sites
Quote:
Original post by bzroom
I agree, usually i'd use separate controls, probably the triggers. But this is for basic movement. Not realistic racing movement. So like say it where controlling a character. How would one remove the dead spots in the corners?
What dead spots in the corners? For that matter, what corners?

The character moves with the same top speed no matter the direction, so rather than thinking about the stick as representing two independent axis, treat it as representing a direction and a magnitude.

Share this post


Link to post
Share on other sites
Thanks everyone, especially aleks_1661.

Bad analogy on my part with the character. It's not for a character.

This blog seems to have plenty of information to hold me over. Thank you.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this