Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Spline Approximation List
#1
Hi,

I am trying to get a object to slightly travel in front of the main gameobject that I have travelling on the spline.


I am wondering how to get the halfway point between two control points perhaps using the approximation list.
public Vector3 lookAtTarget;
public Vector3[] looktargets;
    public void SwitchtoNextFlightSegment(CurvySplineMoveEventArgs e)
    {
        looktargets = e.ControlPoint.Approximation;
        CurvySplineSegment controlPoint = e.ControlPoint;

                int listposition =  Mathf.RoundToInt((Manager.gamesystem.scPlayer.Position * 1.1f) * looktargets.Length);  //10% more on the list;
                lookAtTarget = looktargets[listposition];
             
               ...
             // look at position in playercontroller
               ...

}

wondering what is the best practice for looking ahead down the spline from current position..  Thanks!
Reply
#2
(07-01-2018, 05:23 PM)skyboard Wrote: I am wondering how to get the halfway point between two control points perhaps using the approximation list.

If your first control point is called cpOne, then the halfway position is cp1.Interpolate(0.5f).
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#3
Also, I highly advise you to read this
https://curvyeditor.com/documentation/sp...tart#units
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  Spline Controller restart FlebusCroqus 2 28 05-16-2019, 07:35 PM
Last Post: FlebusCroqus
  Spline Controller Position Force Update ? UsernameHed 1 34 05-16-2019, 12:20 PM
Last Post: _Aka_
  Curvy Coppy all points of a Spline Into Another UsernameHed 3 90 05-13-2019, 11:37 AM
Last Post: _Aka_
  Syncing UI Spline and Regular 3D Spline arrnav96 8 505 03-21-2019, 12:13 PM
Last Post: _Aka_

Forum Jump: