Changing the thing to take decimal values....

In my script I set the camera to be 5 units to the right in the x axis like so:

var targetGO : Transform;
var change : int;
var cameraX : int;

function Start() {


function Update () {

    cameraX = transform.position.x + change;
    targetGO.position = Vector3(cameraX, 2, -10);


The only problem is that when I apply a Constant Force it doesn't follow the gameObject when it is a decimal value and only follows when it hits an integer. How can I make the camera follow even through decimal values?

Set both change and cameraX to float instead of int (cameraX is mandatory, changing change as well will let you set values which aren't integers from the inspector)

var change : float;
var cameraX : float;