Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Dynamic path
#1
I am trying to use Curvy as a way-point system.
I need to make a path between my object and a target point. I dynamically create a new CurvySpline with those two points transforms. Is there a way to pass initial object rotation to make it a curved route , not a straight line without too much calculations?

public SplineWalkerDistance _splineWalker;

_splineWalker.Spline = CreateSpline();

 CurvySpline CreateSpline()
{
        if ( Vector3.SqrMagnitude( _target.position - transform.position ) < 1f)
            return null;

        CurvySpline spline = CurvySpline.Create();
        spline.SetControlPointRotation = true;
        spline.Closed = false;
        spline.InitialUpVector = CurvyInitialUpDefinition.ControlPoint;
        spline.AutoEndTangents = true;
        spline.Granularity = 10;
        spline.AutoRefresh = true;
        spline.AutoRefreshLength = true;
        spline.AutoRefreshOrientation = true;
        spline.ShowApproximation = true;

        Vector3[] vec = new Vector3[2];
        vec[0] = transform.position;
        vec[1] = _target.position;
        spline.Add(vec);

        return spline;
}


 

 

 
Reply


Messages In This Thread
Dynamic path - by savely00 - 01-24-2014, 12:08 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Incorrect mesh alignment after extrusion on curved path Thinkurvy 10 21 04-17-2024, 10:57 AM
Last Post: _Aka_
  Rasterized Path Range issue proton 2 12 04-15-2024, 03:42 PM
Last Post: _Aka_
  Disable rebuild of meshes in dynamic mode Zilk1 1 8 10-04-2023, 09:50 AM
Last Post: _Aka_
Wink Train carriage with 2 bogies following a path arcadeperfect 9 27 08-25-2023, 02:56 PM
Last Post: arcadeperfect

Forum Jump: