1

As u already know , The unity scrollbar value is between 0 to 1 I need a formula to change the value by the parameter I change in the inspector menu, like when I write 5 , the value changes to -5 to +5 , or when I write 10 the 0 to 1 changes to -10 to +10. I created one but its not using parameter Left_Eng = 2.0f * (2.0f * ScrollbarL.value - 1.0f) the formula changes 0 1 to -2 , +2 If anyone have an idea please tell me thanks a lot.

1 Answer 1

1

So you want to map the range [0; 1] to [-x; x], right?

I think you basically already have it

  • [0;1]
  • * 2 => [0;2]
  • - 1 => [-1;1]
  • * x => [-x;x]

So together

var y = x * (2 * scrollValue - 1);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.