Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to know when I'm on a control point
#1
Is there a way to query a spline and ask if I'm near a control point at a given FT? I see if I use a SplineController, I can set up OnControlPointReached. While thats interesting, it would be helpful to know which control point I hit. 

I am actually thinking of creating my own spline controller, however. The one shipped with Curvy is missing some basic needs I have. I need do lots of interpolation using tweening with ease in/out. I was hoping to use the control points as way points to put pickups.

Any guidance with this would be appreciated.

BTW. As a newbie to your product, it would have been helpful if you made a few pages of basic scripting examples. While I appreciate the examples shipped with the product. Sometimes, its difficult to "find the nut" of the problem through all the fluff of the example.

Here's how basic those examples can be:

How to get back position from a spline:
Vector3 position = yourspline.InterpolateFast( time );

How to get orientation from spline:
Quaternion orientation = yourspline.GetOrientationFast( time );

Great product.
Reply
#2
(10-14-2015, 02:50 PM)kloveridge Wrote: Is there a way to query a spline and ask if I'm near a control point at a given FT? I see if I use a SplineController, I can set up OnControlPointReached. While thats interesting, it would be helpful to know which control point I hit. 
At any time, use the conversion methods (see link below) to convert TF to a local F (and getting the segment you're on by this). Besides that, CurvySplineMoveEventArgs.ControlPoint gives you the CP that raised the event. It's misleading in the docs, though the example there shows this. I'll improve the docs by time.


(10-14-2015, 02:50 PM)kloveridge Wrote: I am actually thinking of creating my own spline controller, however. The one shipped with Curvy is missing some basic needs I have. I need do lots of interpolation using tweening with ease in/out. I was hoping to use the control points as way points to put pickups.
Just inherit from SplineController and override e.g. UserAfterUpdate() (see http://www.fluffyunderware.com/curvy/doc...lerssimple). Change the Speed property the way you like, e.g. by using a tweening method (hint: see DevTools' DTTween for the usual ones, ready to use).

To pickup parameters for tweening, use Metadata!

Examine the provided custom controller examples for some additional tricks like adding your fields properly into inspector sections etc...

Quote:BTW. As a newbie to your product, it would have been helpful if you made a few pages of basic scripting examples. While I appreciate the examples shipped with the product. Sometimes, its difficult to "find the nut" of the problem through all the fluff of the example.
We have a list of most common operations here: http://www.fluffyunderware.com/curvy/doc...plines/api
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Find intersection point soccertrash 5 27 10-22-2022, 05:46 PM
Last Post: _Aka_
  Get Closest Point on Spline neppyneptune1 1 5 10-15-2022, 11:17 AM
Last Post: _Aka_
  How can I find the point on the spline after applying with offset angle+radius? Chanon 1 3 10-01-2022, 11:50 AM
Last Post: _Aka_
  How to stop spline refreshing when a control point is deleted or removed? Beaver_Boy 4 8 07-23-2022, 11:24 AM
Last Post: _Aka_

Forum Jump: