Hi Everyone,
I’m just starting to learn Unity and I don’t understand why this code doesn’t work. i would create a cube and move it. The code run correctly but my cube doesn’t move.
Thank you for your help
Julien
My code:
var cube;
var end : Transform;
function Start () {
cube = GameObject.CreatePrimitive(PrimitiveType.Cube);
//cube.AddComponent(Rigidbody);
cube.transform.position = Vector3 (0, 0, 0);
end.transform.position = Vector3 (10, 0, 0);
}
function Update () {
cube.transform.position = Vector3.Lerp(transform.position, end.position, Time.deltaTime);
}