playMaker

Author Topic: Controller/ Joystick Calibration system?  (Read 3469 times)

devotid

  • Playmaker Newbie
  • *
  • Posts: 45
Controller/ Joystick Calibration system?
« on: June 23, 2012, 02:48:54 PM »
I have been trying to avoid using a "Reg Hack" with my controllers..... (Im using Unity 3.4.2) because 3.5.1 dropped support for the "Older windows Direct Input" i have to use the 3.4.2 for now while i finish this current title.

NOTE: The reason i have to use the reg hacks is because the controllers are not centering properly and not getting full "lock" in each direction.  So i have to use the "registry hacks" that "force" unity to use the windows Direct Input instead of Raw Input.

My question is how do i build a calibration system for players to make sure they are "centered up" and getting full stoke on there joystick?   like this -1,0,1 ?

i guess i am looking for a basic idea of how it would work...... i think i can make it happen once i get the drift of the idea....

MY THOUGHT OUT EXAMPLE:

First....Get player to click gui button when the stick is centered...(Then reset all axis?)
Then....get player to move the stick left to right....... (this is were i dont know how to record the players input and set it as the "new updated settings")

What actions should i look into?

How do i save or store the new axis's?

any help would be greatly appreciated.

Kevin.
devotid

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15496
  • Official Playmaker Support
Re: Controller/ Joystick Calibration system?
« Reply #1 on: June 23, 2012, 04:28:29 PM »
Hi,

to find out about the min and max you can use the following actions:

"Float Operator": in there you can find out the min and max between two values. use this on update as the user move to store the min and max values

when you have these min and max values ( check for it on each update while the user is in calibration mode on your system), compare them with the centered stick value you found in your first step, and that will give you the min range and max range, when not calibrated, then you can find the multipler for the negative and positive range and use that for distributing a full input range.

examples:

current values [-0.9,0.1,0.8]
so the negative range is 1 actually
the positive range is 0.7

so when the current input is 0.3, the actual value you want will be (0.3-0.1)/0.7 ( current value - center)/(range)
you'll need to know when the current value is above or below the center to know which range and offset to apply.

This is UNTESTED, but this is the direction I would take to give it a go.

But, I am very sceptical that it would work on all cases, because when not calibrated, input axis can be not just offseted and with bad ranges, but also completly off the map, with jumps, etc etc. So... with caution...

bye,

Jean