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
  Duplicate Prefab along path rickgplus 1 1,541 01-23-2025, 10:09 AM
Last Post: _Aka_
  Can't set CG Path Controller j95677 4 3,226 10-04-2024, 06:55 PM
Last Post: j95677
  Scene 51: Dynamic track between two points wallflower6 3 2,473 08-19-2024, 08:18 AM
Last Post: _Aka_
  Disable rebuild of meshes in dynamic mode Zilk1 3 2,238 05-27-2024, 08:14 AM
Last Post: _Aka_

Forum Jump: