Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Curvy API - Rolling an aircraft into a turn?
#1
Question 
Hello,

I'm using Curvy in my project to move enemy aircraft along a spline path. I wanted to extend the SplineController class to have the enemy "bank" or "roll" into a turn when steering left or right.

What would be the easiest way to implement this behavior in Curvy? If Curvy is already calculating something like rotational "velocity" - something that ignores the orientation of the control points, though - I think that would be what I would want to use to determine how far left or right I should roll the enemy ship controller. Is there some function or variable I can access like this?

Thanks!
Reply
#2
Hi,

there is no builtin solution and Curvy doesn't store curvation deltas directly. But you can access CurvySplineSegment.ApproximationT[] to get tangents (i.e. direction) of cache points and calculate directional velocity from this.

To find the array index to start use getApproximationIndexINTERNAL().

To max this, create a custom metadata class that automatically fills an array (ApproximationDirVel[] or such). You then can easily access that from a custom controller to add smooth rolling.

Does that help?
Reply
#3
(02-01-2017, 07:45 PM)Jake Wrote: Hi,

there is no builtin solution and Curvy doesn't store curvation deltas directly. But you can access CurvySplineSegment.ApproximationT[] to get tangents (i.e. direction) of cache points and calculate directional velocity from this.

To find the array index to start use getApproximationIndexINTERNAL().

To max this, create a custom metadata class that automatically fills an array (ApproximationDirVel[] or such). You then can easily access that from a custom controller to add smooth rolling.

Does that help?

Hi Jake,

This makes sense, I have some questions though:

  1. Will this method work even when my SplineController subclass does not have "Use Cache" checked?
  2. Could you explain more about this custom metadata class? Would this class be attached to a Control Point object? Wouldn't that only let me adjust the roll of the custom controller per control point with interpolation in between? This might not match the curve between points.
Thanks!,
Kyle
Reply
#4
1.) Unless you lower the spline's cache density to 1, the spline's cache data is there and usable...
2.) Metadata is attached to Control Points, right. But you can store as much data as you want (say, 1/2 data from last segment, 1/2 from next) and also access previous/next segment's metadata. See the 01_MetaData example for usage of metadata.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  snap to the curve created by the curvy splines segment points ShiroeYamamoto 0 0 5 hours ago
Last Post: ShiroeYamamoto
Exclamation Extending Curvy Generator for Advanced Lofting - Feasibility Check amutp 2 4 Yesterday, 07:25 AM
Last Post: amutp
  8.8.0 is live, and it improves Curvy Generator greatly _Aka_ 0 6 Yesterday, 03:23 AM
Last Post: _Aka_
  Using Unity's SplineContainer in Curvy Splines dlees9191 3 15 02-26-2024, 09:49 AM
Last Post: _Aka_

Forum Jump: