C# move a cube slowly

Hello, Im trying to move an object using this code objectToMove.transform.position = new Vector3(-75, 6, -13); and the cube Im moving is moving instantly, I tried checking the Unity Script reference and tried out putting objectToMove.transform.position = new Vector3(-75, 6, -13 * Time.Deltatime); but then the cube didn’t want to move at all.

Anyone got a solution for this problem?

1 Answer

1

Hey Sveyh,

Try that instead

objectToMove.transform.Translate(Vector3.up);

it is a unity function that takes in a vector parameter for example and apply the translation over time through update, Vector3.up is just saying this for us instead of writing ita ll out

new Vector3(0.0f, 1.0f, 0.0f)

TheTransform.Translate()re is a link below, you shoul dlook at that instead of transform.position stuff.

Take care bud
Gruffy

Awesome :>

It is ! Enjoy Unity, your gonna have alot of fun! And make sure you visit those docs in that link and keep the docs bookmarked too! Take care bud Gruffy :)