Get Time by Length

I want to get the Time from Length.


Here’s what I mean:

With an object that moves, let’s say, 4 studs per second, how do I get the time between Vector3.new(0,1,0) and Vector3.new(0,10,0)?

Can’t you just like subtract the 2 vectors, get their magnitude and divide it by whatever the velocity is to find how much time passed in seconds?

print((Vector3.new(0,10,0) - Vector3.new(0,1,0)).Magnitude / 4) --Like this?

Apparently not


The result should be the Time value?

distance = speed * time
speed = distance / time
time = distance / speed

if the speed is in studs per second then the time will be in seconds

1 Like

Time-distance-speed equation is pretty simple and interchangeable. What @BenMactavsin posted is correct.

time = distance / speed

So your distance is the magnitude of the difference between your vectors, then you divide by your speed. That will give you the time.

3 Likes

Yes, unless there is also acceleration involved and/or you’re only accounting for displacement between 2 points and not distance that is actually travelled.

Nah, the speed is constant.