Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / True 360 with joypad, how do you do it?

Author
Message
Cybermind
Valued Member
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: Denmark
Posted: 15th May 2019 11:05 Edited at: 15th May 2019 11:55
Hi I am trying to get 360 degrees shooting with an Xbox 360 controller, I use agk::ATanFull(agk::GetRawJoystickRX(1), agk::GetRawJoystickRY(1)) to get an angle, but it kinda "locks" to up, down, left and right, and when moving the stick it jumps about 10 degrees from those directions, so if I am pressing up and start moving a little to the left, it jumps from 0 to 351, from there it is fine until I get close to another straight direction where it "jumps" again. Is there any way to avoid these jumps?
13/0
Bengismo
7
Years of Service
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 16th May 2019 22:02 Edited at: 16th May 2019 22:03
Hi

you can use SetRawJoystickDeadzone(0) Use a small value close to zero

by default the joystick deadzone is about 15% so that when it isnt moved it reports 0 even though in reality its reporting somewhere near 0 but not quite exactly 0. A 15% deadzone means that when you calculate an angle you wont ever get angles correctly close to 0, 90,180,270 degrees. When you set the deadzone to zero you correctly get these angles but be careful to make sure that the values are large enough to be valid.
Cybermind
Valued Member
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: Denmark
Posted: 20th May 2019 11:00
Awesome Bengismo That will solve my issue I have my own deadzone code, so this is amazing! Thank you very much!!!
13/0

Login to post a reply

Server time is: 2024-11-22 21:07:07
Your offset time is: 2024-11-22 21:07:07