[SOLVED] Calculate point along a line based on travel time

I have two points in 3d space. I know when I left Point A and when I’ll arrive at Point B and can thus calculate how long I’ve been traveling along the line.

If I’m traveling at a constant rate, how can I calculate the point where I’m at “now” on the line?

Hello @rscott78 :wave: Welcome!

As you want to know where you are at specific time, I like to suggest you this project.

Camera following a path

https://developer.playcanvas.com/en/tutorials/camera-following-a-path/

Please take a look. I hope it will help you.

2 Likes

If you know the exact percentage in the range 0 to 1 of where you are at any point, you can use lerp between the two points to get the current:

https://developer.playcanvas.com/api/pc.Vec3.html#lerp

3 Likes

Thank you, this worked well.

1 Like