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!
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!