playMaker

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

kavery

  • Full Member
  • ***
  • Posts: 149
Touch Axis Input - make 0 to 1 instead of -1 to 1?
« on: March 04, 2019, 11: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: 149
Re: Touch Axis Input - make 0 to 1 instead of -1 to 1?
« Reply #1 on: March 04, 2019, 11: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

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