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
Information Curvy 6.0.0 is live _Aka_ 2 111 08-23-2019, 02:15 PM
Last Post: _Aka_
  Curvy Spline mover is jerky BlankMauser 5 87 08-16-2019, 09:31 PM
Last Post: _Aka_
  UI button to start Curvy Spline in scene funkd 1 133 07-12-2019, 11:19 AM
Last Post: _Aka_
  Import Curvy from json Issue mlndb10wN 5 545 05-29-2019, 06:46 PM
Last Post: _Aka_

Forum Jump: