currently having some fun in XNA programming a topdown shooter towards the XBox-controller but I’m having some issues right now.
So I move my character with the left thumbstick and aim with my right, so essentially I can move in any direction and still shoot in 360 angle. What I have right now works, but it’s very sensitive and “tacky”, it likes to stick a bit extra on all the 90 angles before it moves on to the next angle if I’m moving the thumbstick in a perfect outer circle.
So this is what I have right now:
direction.X = gpState_new.ThumbSticks.Right.X;
direction.Y = gpState_new.ThumbSticks.Right.Y;
rotation = Math.Atan2(direction.Y, direction.X);
And then when I draw the player I use rotation as the angle of which I’m drawing it.
Do you got any tips on how to do this better ?
Fredrik
It looks like this is because of the “deadzone” on the stick. The basic fix is probably something like is to use GamePadDeadZone.Circular. Perhaps before your code, something like
A very similar question was asked on GameDev (and you can see a more detailed answer there), which you might have better luck on with this kinds of questions in the future.