moving an object

How would I move an object in 0.1 units, 10 times… and get it to equal 1.0 everytime, without rounding?

There’s a lot of ways to go about it, but it would be best if you were a bit more specific. What is the object beeing moved, how do you move it in the game, and how is its movement handled (physics, translation, etc)?

The object being moved is a cube.

A trigger event or collision event could cause it to start moving. no physics. just transform.position.x I would suppose.

function OnTriggerEnter (hit : Collider) {
    for(var i = 0; i < 10; i++) {
        transform.position.x += 0.1;
    }
}

alternative loop :

function OnTriggerEnter (hit : Collider) {
    var finalPosition : Vector3 = transform.position + Vector3(1.0,0,0);
    while(transform.position != finalPosition) {
        transform.position.x += 0.1;
    }
}

Pretty self explanatory unless I didn’t understand your exact problem…

Those aren’t working for me. It gives me. 4.099998
and overtime… 47.69984…

Probably a simple issue of dealing with floating point values. I just don’t know how to do that in unity.