Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Using Curvy for a "Ghost" player
#1
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:


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?
Reply


Messages In This Thread
Using Curvy for a "Ghost" player - by mythstified - 04-08-2019, 04:38 AM
RE: Using Curvy for a "Ghost" player - by _Aka_ - 04-08-2019, 12:38 PM
RE: Using Curvy for a "Ghost" player - by _Aka_ - 04-08-2019, 12:40 PM
RE: Using Curvy for a "Ghost" player - by _Aka_ - 04-09-2019, 11:02 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Curvy Line Renderer for UI Spline? gekido 3 6 04-04-2024, 12:56 PM
Last Post: _Aka_
  8.8.0 is live, and it improves Curvy Generator greatly _Aka_ 1 10 04-03-2024, 03:16 PM
Last Post: _Aka_
  snap to the curve created by the curvy splines segment points ShiroeYamamoto 3 11 04-02-2024, 02:24 PM
Last Post: _Aka_
Exclamation Extending Curvy Generator for Advanced Lofting - Feasibility Check amutp 2 4 03-27-2024, 07:25 AM
Last Post: amutp

Forum Jump: