Hi.
How to get the angle of gamepad stick?
Thanks for replies.
Angle of gamepad stick
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- McPandaBurger
- Prole
- Posts: 16
- Joined: Sat Apr 28, 2012 3:32 pm
Re: Angle of gamepad stick
is this a ps3 pad by any chance? I'm having the same issue if it is, see here incase anything so far helps you, I'm totally stumped but you might crack it.
viewtopic.php?f=4&t=9192
viewtopic.php?f=4&t=9192
I have no idea what I'm doing
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: Angle of gamepad stick
It doesn't have an angle, it has two axes (per stick), an x and a y axis.
Re: Angle of gamepad stick
No, I have a Xbox 360 controller.
Re: Angle of gamepad stick
You wouldn't read the analogs as an angle, unless your talking about which direction your pushing the analog stick in.Arthes wrote:Hi.
How to get the angle of gamepad stick?
Thanks for replies.
If that's the case you could do something like this:
Code: Select all
math.atan2((deadzone.y - current_position.y), (deadzone.x - current_position.x))
current_position is the read you get from the analog. If it's in the deadzone then deadzone and current_position will cancel out.
Hope I helped
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: Angle of gamepad stick
Arthes wrote:No, I have a Xbox 360 controller.
I'm not quite sure how you think they work, but they work like I said it. If you want an angle, you'd better calculate it yourself.bartbes wrote:It doesn't have an angle, it has two axes (per stick), an x and a y axis.
Who is online
Users browsing this forum: No registered users and 8 guests