Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Using Curvy for a "Ghost" player
#4
(04-08-2019, 12:38 PM)_Aka_ Wrote: Hi,

To get the length of the segment between CP0000 and CP0001, you cal call CP000.Length. The Length is computed using linear approximations of the curve, so the less cache density your spline will have, the less precise Length will be.
So based on this, your movement speed should be CP000.Length / 5.2

Did this answer your question?

Ok so this pretty much works, it's funny because the final result I don't get 7.5 but somewhere close to 7.5 each time, and that's even using the spline length as provided by curvy.  Weird.  One thing I realized is that the length needs to be grabbed from the previous spline because it's the length going forward (thus the last spline has a length of 0).

I wonder if this is the best way to grab that? 

Code:
float distanceLastSpline = ghostSpline.transform.GetChild(ghostSpline.transform.childCount - 2).GetComponent<CurvySplineSegment>().Length;

Seems pretty messy, but does the trick.

Basically will go to the object level, find how many children are there (with a 1 start, not 0 start), so -1 would be the last segment, and -2 is the second last segment. I can get the length here to get the second last segment to the last segment length.
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 mythstified - 04-08-2019, 05:03 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 5 03-27-2024, 07:25 AM
Last Post: amutp

Forum Jump: