3 Replies - 270 Views - Last Post: 13 January 2013 - 04:02 PM Rate Topic: -----

#1 guitardenver  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 13-January 13

Converting Joystick voltage to movement.

Posted 13 January 2013 - 03:02 AM

Hello,

I'm working on a project that controls an Xbox controller from a micro-controller. I am wondering if any of you guys (game programmers) would know if there is some standard function (mathematical function) that they use to convert the potentiometer voltage of the joystick to some velocity in the game. I'm talking about a game like Halo. Converting the voltage to how fast he runs or specifically the angular velocity the gun pointer moves, the courser moves in a circle. I'm pretty sure its some kind of exponential function or logarithmic or some higher order polynomial. I can find out by plotting a tun of points and getting a function of the plot. But I thought maybe there is already a known function for it. I hope my question is clear.


Thanks,
Matt

Is This A Good Question/Topic? 0
  • +

Replies To: Converting Joystick voltage to movement.

#2 anonymous26  Icon User is offline

  • D.I.C Lover

Reputation: -1
  • View blog
  • Posts: 3,638
  • Joined: 26-November 10

Re: Converting Joystick voltage to movement.

Posted 13 January 2013 - 02:32 PM

Are you aware how controller work in the first place, like the buttons are either in a pressed state or not? Also the thumb sticks and triggers have a range of values? I have no idea what you're trying to do tbh. :\
Was This Post Helpful? 0
  • +
  • -

#3 guitardenver  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 13-January 13

Re: Converting Joystick voltage to movement.

Posted 13 January 2013 - 02:51 PM

Yes I know this. Ok, each thumb stick has two potentiometers ( variable resistors) for each direction. When you change resistance there is a change in voltage and the controller does an analog to digital conversion. The range that the controller sends to the xbox let say is 0 to 1024 because its a 10 bit ADC. Half that range is when the joystick is at rest. When some threshold is reached the player starts moving and when some max threshold is reached the player is moving as fast as the look sensitivity allows. The relationship between the range of values that the controller sends the xbox and the range of speed the player goes is NOT linear. Linear meaning not in this kind of form y = mx + b. It is some exponential function f(x) = ae^bx. This means as you move the joystick up the players speed increases exponentially.

With that said i'm assuming this function varies from game to game and look sensitivity. I think the game developers don't have some conventionalized function that relates the range of values the controller sends the xbox and the speed of the person is. This is why i'm doing it the hard way by plotting a bunch of data and using MatLab or Mathamatica to give me a function of that graph.

But before I do all that hard work, I thought i'd asked to see if there is a conventionalized function that xbox game designers have. I don't have my hopes to high.
Was This Post Helpful? 0
  • +
  • -

#4 anonymous26  Icon User is offline

  • D.I.C Lover

Reputation: -1
  • View blog
  • Posts: 3,638
  • Joined: 26-November 10

Re: Converting Joystick voltage to movement.

Posted 13 January 2013 - 04:02 PM

There is no conventional whatever. How the game reacts to user input is set in the game and not in the hardware; the hardware simply sends messages to the game and the game decides what to do and how much to do it.

Have a look at some XInput examples as part of the DirectX SDK.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1