How to define target.position in Vector3.MoveTowards?

So I’m looking at Unity - Scripting API: Vector3.MoveTowards but I do not understand how to define target.position. I want to move the object in it’s Y axis +1 but I don’t know how.

Edit, this is what I have:

Vector3 TargetPosition = new Vector3(0, 1, 0);
Vector3.MoveTowards(transform.position, TargetPosition, JumpMovementSpeed * Time.deltaTime);

Vector3.MoveTowards doesn’t modify any of the values you pass as parameters, it Returns a new Vector3 that is modified based off your parameters (transform.position, TargetPosition, JumpMovementSpeed * Time.deltaTime).

In your case:
transform.position = the objects current position
TargetPosition = the position you want the object to move towards
JumpMovementSpeed * Time.deltaTime = your movement or step between MoveTowards calls.

To make the code you wrote do anything you need to take the returned Vector3 and change the transform’s position.

This:

Vector3 TargetPosition = new Vector3(0, 1, 0);
Vector3.MoveTowards(transform.position, TargetPosition, JumpMovementSpeed * Time.deltaTime);

becomes:

Vector3 TargetPosition = new Vector3(0, 1, 0);
transform.position = Vector3.MoveTowards(transform.position, TargetPosition, JumpMovementSpeed * Time.deltaTime);

If you do this without any constraints, you may run into a propblem, you may want to wrap it around a key pressed or some bool that is triggered when something happens.

MoveTowards help you when you want to move an object from A to B with a defined distance.

Maybe I haven’t understand, but if you just want to move an objet along an axis, you just have to use Translate, with the Vector3.Up, Vector.Left or Vector3.Front like this :

tranform.translate(Vector3.Up * JumpMovementSpeed * Time.deltaTime);