#How to make an object reach somewhere within a timeframe?
1 messages · Page 1 of 1 (latest)
Use an Update if it’s that much of an issue, and make sure the math your doing is correct
Also questions like these tha are mainly math based any AI can answer
But there's also authority changes to take into account and such
I just need to divide the distance by the time but I don't know how
Authority really won’t change just set the object authority to whoever is running the position stuff

Ask AI
There’s object set authority
Cv2 is build from C# it uses all the C# methods and functions, if you ask AI it’ll tell you the math
start = starting position
end = destination
step size = distance from start to end / time
elapsed time = time - float variable saved to time
start + (direction to end normalized * elapsed time * step size)
using float variable makes completely dependant on time regardless of update rate. After time is up, you may still need to set the object at the start bc floating point but ye
Thank you so much!!
🤝
np 
FYI ai gave me the same exact thing @eager oriole
gave me that method and a lerp method
yeah thats just me saying the jist of it. I usually have to be in game to optimize it
pos = Lerp(start, end, elapsed time / duration)
is prob cleaner in circuits. I usually think in code first
but in code it makes it clearer that start & float variable need to be set before anything
then if i had to complete it, i would use state machine (with execution int switch, not the built in)
IGLT = Instance Get Lifetime
30Hz, if object authority
Switch(State, [1,2]):
- Failed:
- Do Nothing
- 1:
- Start pos = get position(object)
- Start time = IGLT
- End time = IGLT + duration
- Set Rotation(object, destination - Start pos)
- State = 2
- 2:
- If IGLT > End time:
- Then:
- Set Position(object, destination)
- State = 0
- Else:
- Set Position(object, Lerp(Start pos, destination, (IGLT - Start time) / duration))
- Then:
- If IGLT > End time:
@eager oriole
Thank you!! I was wondering if there was a universal precise seconds, which I guess is what IGLT is for!