playMaker

Author Topic: Touch Axis Input - make 0 to 1 instead of -1 to 1?  (Read 108 times)

kavery

  • Full Member
  • ***
  • Posts: 109
    • View Profile
Touch Axis Input - make 0 to 1 instead of -1 to 1?
« on: March 04, 2019, 09:29:02 AM »
I'm using a Vive controller and getting the touchpad axis V2. I'm then converting that to an HSV value so you can change the Hue of something by sliding around on the touchpad.

But instead of -1 to 1, I would like it to be 0 to 1 (but actually 0 to 255 after I set a multiply of 255, which right now becomes -255 to 255)

Any help would be swell, thanks! 

kavery

  • Full Member
  • ***
  • Posts: 109
    • View Profile
Re: Touch Axis Input - make 0 to 1 instead of -1 to 1?
« Reply #1 on: March 04, 2019, 09:42:31 AM »
I might have a solution - using float compares to jump between 2 states, one when you are above 0 and the other below 0. Then each state uses math differently to transition through each half of the 255 spectrum.

Would love to know if there is a simpler approach, but this isn't too bad. 

Thore

  • Full Member
  • ***
  • Posts: 207
    • View Profile
Re: Touch Axis Input - make 0 to 1 instead of -1 to 1?
« Reply #2 on: March 04, 2019, 05:33:44 PM »
Use float absolute, or float remap — the latter from the ecosystem.