# Calculate distance with velocity and time

The object has a beginning coordinate (x1, y1, z1) and end coordinate (x2, y2, z2).

I have velocity and time. How can I calculate the distance (x3, y3, z3) traveled during this time?.

``````Vector3f pointStart = new Vector3f(0, 0, 0);
Vector3f pointEnd = new Vector3f(20, 20, 20);

Vector3f delta = pointEnd .subtract(pointStart );
Vector3f dir = delta.normalize();

float traveled = velocity * time;

Ray ray = new Ray(pointStart, dir);
ray.setLimit(traveled);
``````

i need something like that

``````Vector3f pointTraveled  = ray.getLimitPoint();
``````

If I am understanding your problem correctly, you should do
`Vector3f pointTraveled=dir.mult(traveled);`

1 Like

…but this is also kind of a strange thing to want to know.

What is it that you are actually trying to do?

1 Like

The object starts moving from one place to another. I need to save the position of the object by the button, but I don’t want to use simpleInitApp(), only math.

so simple)) thx, this is what i need

1 Like

“by the button”… meaning the user clicks a button and you want to save the position of the object?

…but can’t you just ask the object its position?