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
  Question regarding Spline Generated Path linkinballzpokemon 9 151 07-01-2020, 06:10 PM
Last Post: _Aka_
  Converting spline collider hit point to spline position jh092 7 116 06-26-2020, 09:48 PM
Last Post: _Aka_
  Null reference when spline controller added runtime jh092 1 84 06-19-2020, 09:21 AM
Last Post: _Aka_
  Rotation of Curvy Spline Segment jh092 1 119 05-31-2020, 09:36 AM
Last Post: _Aka_

Forum Jump: