How do I set an objects position based on a current value?

Hi, bit of a tricky one…

I have a cube with its X axis on 0. It’s max is 3.09 .

Next , I have a float value with a min & max from 0 to 8000. called Fling_SPEED

here’s the scenario.

If the Fling_SPEED value is half (4000), I need the Cubes x position to be half.(1.54)

say the Fling_SPEED value is 2000, I need the Cubes x position to be a quarter.(0.77)

and so on.

I know it’s probably a simple formula but I can’t figure it out.

kind of an example so you get a gist. (obviously not right)

var Cube : GameObject;
var cubes_max_x_position : float = 3.09;

FlingSpeedmin : float = 0;
var FlingSpeedmin: float = 0;
var FlingSpeedmax: float = 8000;

function Update(){
//FlingSpeed lerps from min to max in say 2 seconds here


Cube.transform.position.x = cubes_max_x_position  / FlingSpeed;

}

Thanks, Tim.

Hi,

it is:

Cube X position = 3.09/8000 * Fling_SPEED

regards