04-08-2019, 04:38 AM
So I'm recording my player as they trek through my map's splines. Each control point, I mark the Vector3 Position and a TimeStamp of the level time played (which is a float). The original map will have hundreds of separate splines that dynamically join based on the choice of the player, however the GhostSpline is a single spline that freezes all the decisions the player made as a single path. So far it's working like a charm. Got it recording, saving to file, loading from file, and building the ghost spline dynamically from the file's position data.
Ok, so here's the fun part. I'm going to make a Ghost that travels along this spline. So here's a math question for you:
Straight distance between CP0000/CP0001 is 25.40623 (using Pythagorean), and it took exactly 6.7206934094429 seconds for this distance.
Please note that I used a static 7.5 movement speed on the original spline. Normally the player's speed will be variable, but I don't want to mark down movement speeds every frame since that would generate huge data files. So the ghost isn't going to speed up/slow down between splines, but will get to the end of the spline at the same time the player did even if the player did speed up/slow down.
So with the above stats, I need to tell my ghost spline to move at a speed of 7.5 (or close to it). If I do the same test again but with a movement speed of 10.0 (exact same coordinates above), it takes 5.270451307296753 seconds..
Now, I could probably use some of your build in functions to get a more accurate spline length between the two segments, as it curves so a straight line calc won't be accurate and why reinvent the wheel anyway.
So, bottom line, say I deduce the distance between two control points, 25.4, and I want it to take 5.2 seconds to traverse that distance, what should my movement speed be?
Ok, so here's the fun part. I'm going to make a Ghost that travels along this spline. So here's a math question for you:
Code:
X Y Z
CP0000 272.885009765625 29.2959995269775 238.434997558593
CP0001 249.352996826171 37.8520011901855 234.132003784179
Delta -23.532012939454 8.556001663208 -4.30299377441401
Straight distance between CP0000/CP0001 is 25.40623 (using Pythagorean), and it took exactly 6.7206934094429 seconds for this distance.
Please note that I used a static 7.5 movement speed on the original spline. Normally the player's speed will be variable, but I don't want to mark down movement speeds every frame since that would generate huge data files. So the ghost isn't going to speed up/slow down between splines, but will get to the end of the spline at the same time the player did even if the player did speed up/slow down.
So with the above stats, I need to tell my ghost spline to move at a speed of 7.5 (or close to it). If I do the same test again but with a movement speed of 10.0 (exact same coordinates above), it takes 5.270451307296753 seconds..
Now, I could probably use some of your build in functions to get a more accurate spline length between the two segments, as it curves so a straight line calc won't be accurate and why reinvent the wheel anyway.
So, bottom line, say I deduce the distance between two control points, 25.4, and I want it to take 5.2 seconds to traverse that distance, what should my movement speed be?