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).
Available for freelance work, feel free to reach out: toolbuddy.net
Please consider leaving a review for Curvy, this helps immensely. Thank you.
Reply
#3
Also, I highly advise you to read this
https://curvyeditor.com/documentation/sp...tart#units
Available for freelance work, feel free to reach out: toolbuddy.net
Please consider leaving a review for Curvy, this helps immensely. Thank you.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Filling a closed spline dynamically rickgplus 1 225 04-16-2025, 08:56 AM
Last Post: _Aka_
  Disable a spline's gizmo when not selected or disabled. mikechr2000 1 284 02-03-2025, 09:34 AM
Last Post: _Aka_
Information Questions regarding spline colliders and collisions with rigidbodies Spyboticer 7 1,087 01-20-2025, 12:25 PM
Last Post: _Aka_
  Extrude mesh along spline. New and confused user GhostStalker 3 525 01-02-2025, 09:58 AM
Last Post: _Aka_

Forum Jump: