What's up with gamepad axes?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
User avatar
BrotSagtMist
Party member
Posts: 665
Joined: Fri Aug 06, 2021 10:30 pm

Re: What's up with gamepad axes?

Post by BrotSagtMist »

Ohwell while adding transparency i kinda deleted all the lines. So much cpu wasting lines...

Code: Select all

love.window.setMode(0,0)  
joystick = love.joystick.getJoysticks()[1]
drawCanvas = love.graphics.newCanvas()
distance = 500
bla=    function()      love.graphics.circle("fill", joystick:getGamepadAxis("leftx")*distance+love.graphics.getWidth()/2, joystick:getGamepadAxis("lefty")*distance+love.graphics.getHeight()/2,20)    end
function love.draw() 
 love.graphics.setColor(1,1,1,.1)
  drawCanvas:renderTo(bla) 
 love.graphics.setColor(1,1,1,1)
  love.graphics.circle("line", joystick:getGamepadAxis("leftx")*distance+love.graphics.getWidth()/2, joystick:getGamepadAxis("lefty")*distance+love.graphics.getHeight()/2, 55)
  love.graphics.draw(drawCanvas)
end
But anyway point is, this is what two of my pads return on doing a slow circle and pushing diagonal:
shot-2023-04-28_17-51-22.png
shot-2023-04-28_17-51-22.png (57.64 KiB) Viewed 964 times
shot-2023-04-28_17-56-50.png
shot-2023-04-28_17-56-50.png (106.07 KiB) Viewed 964 times
Can you guess which is the cheaper pad?
Note how the upper is obvously broken sensoric wise but the other doesnt center, so yes they kinda suck booth. Kinda genuine xbox360 btw.
My third pad doesnt even work with this kind of code.
obey
User avatar
zorg
Party member
Posts: 3470
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: What's up with gamepad axes?

Post by zorg »

In most games (and whatever calibration utility steam has), circles are just guidelines for you to orient yourself by; deadzones and scaling makes your controller input behave calibrated in the sense that two things happen:
- no movement in resting position,
- 100% input in all directions if you push the joystick to the furthest extent; it might not be a circle in terms of the raw input, but that's why you constrain the input to a smaller actual circle shape.
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
MrFariator
Party member
Posts: 563
Joined: Wed Oct 05, 2016 11:53 am

Re: What's up with gamepad axes?

Post by MrFariator »

Games sometimes also tailormake their deadzones, so to perhaps suit the specific game's needs. Admittedly this won't always work, but for games that target specific controllers (eq. console exclusives), they have a pretty good idea of what the ranges they're working with.
User avatar
Bobble68
Party member
Posts: 162
Joined: Wed Nov 30, 2022 9:16 pm
Contact:

Re: What's up with gamepad axes?

Post by Bobble68 »

MrFariator wrote: Sat Apr 29, 2023 10:16 am Games sometimes also tailormake their deadzones, so to perhaps suit the specific game's needs. Admittedly this won't always work, but for games that target specific controllers (eq. console exclusives), they have a pretty good idea of what the ranges they're working with.
That's interesting, probably a good idea to bare this in mind for my game. I think in my case its best to have mostly registered diagonals given the nature of my game.
Dragon
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot], CutePenguin and 6 guests