Range of numbers to rotation angle

Hi,

I need to rotate a mesh in radian from -0.75 to +0.75 as displayed here Babylon.js Playground.

Radian angles needs to be derived from range of numbers (0 to 100). Value 0 should set the angle to -0.75 and value 100 set the angle to +0.75.

Should this be done by simply dividing range of angles with total numbers, [0.75 - (-0.75)] / 100 = 0.015? (where, 0.015 is multiplied to numbers)
or
Is there a predefined function for this type of conversion?

Thanks.

You can use the Lerp function that will interpolate with a scalar between 0 and 1:

https://playground.babylonjs.com/#7XCA3E#1

2 Likes

Thanks for the information.
Lerp and InverseLerp functions help converting number range (0 to 1) into angles and vice versa as here https://playground.babylonjs.com/#7XCA3E#2