- Developed by Dented Pixel
API Docs for: LeanTween 2.46

Support LeanTween!

Maintaining and adding new features takes time, your support is appreciated.

Show:

LTSpline Class

Defined in: LeanTween.cs:2774

Animate along a set of points that need to be in the format: controlPoint, point1, point2.... pointLast, endControlPoint

Move a GameObject to a certain location

Constructor

LTSpline

(
  • pts
)

Defined in LeanTween.cs:2774

Parameters:

  • pts Vector3 Array

    A set of points that define the points the path will pass through (starting with starting control point, and ending with a control point)
    Note: The first and last item just define the angle of the end points, they are not actually used in the spline path itself. If you do not care about the angle you can jus set the first two items and last two items as the same value.

Example:

LTSpline ltSpline = new LTSpline( new Vector3[] { new Vector3(0f,0f,0f),new Vector3(0f,0f,0f), new Vector3(0f,0.5f,0f), new Vector3(1f,1f,0f), new Vector3(1f,1f,0f)} );

LeanTween.moveSpline(lt, ltSpline.vec3, 4.0f).setOrientToPath(true).setDelay(1f).setEase(LeanTweenType.easeInOutQuad); // animate
Vector3 pt = ltSpline.point( 0.6f ); // retrieve a point along the path

Methods

place

(
  • transform:Transform
  • ratio:float
)

Defined in LeanTween.cs:2992

Place an object along a certain point on the path (facing the direction perpendicular to the path)

Move a GameObject to a certain location

Parameters:

  • transform:Transform Transform

    the transform of the object you wish to place along the path

  • ratio:float Float

    ratio of the point along the path you wish to receive (0-1)

Example:

ltPath.place( transform, 0.6f );

place

(
  • transform:Transform
  • ratio:float
  • rotation:Vector3
)

Defined in LeanTween.cs:3005

Place an object along a certain point on the path, with it facing a certain direction perpendicular to the path

Move a GameObject to a certain location

Parameters:

  • transform:Transform Transform

    the transform of the object you wish to place along the path

  • ratio:float Float

    ratio of the point along the path you wish to receive (0-1)

  • rotation:Vector3 Vector3

    the direction in which to place the transform ex: Vector3.up

Example:

ltPath.place( transform, 0.6f, Vector3.left );

placeLocal

(
  • transform:Transform
  • ratio:float
)

Defined in LeanTween.cs:3024

Place an object along a certain point on the path (facing the direction perpendicular to the path) - Local Space, not world-space

Move a GameObject to a certain location

Parameters:

  • transform:Transform Transform

    the transform of the object you wish to place along the path

  • ratio:float Float

    ratio of the point along the path you wish to receive (0-1)

Example:

ltPath.placeLocal( transform, 0.6f );

placeLocal

(
  • transform:Transform
  • ratio:float
  • rotation:Vector3
)

Defined in LeanTween.cs:3037

Place an object along a certain point on the path, with it facing a certain direction perpendicular to the path - Local Space, not world-space

Move a GameObject to a certain location

Parameters:

  • transform:Transform Transform

    the transform of the object you wish to place along the path

  • ratio:float Float

    ratio of the point along the path you wish to receive (0-1)

  • rotation:Vector3 Vector3

    the direction in which to place the transform ex: Vector3.up

Example:

ltPath.placeLocal( transform, 0.6f, Vector3.left );

point

(
  • ratio:float
)
Vector3

Defined in LeanTween.cs:2951

Retrieve a point along a path

Move a GameObject to a certain location

Parameters:

  • ratio:float Float

    ratio of the point along the path you wish to receive (0-1)

Returns:

Vector3:

Vector3 position of the point along the path

Example:

transform.position = ltSpline.point( 0.6f );

ratioAtPoint

(
  • point:Vector3
)
Float

Defined in LeanTween.cs:2927

Retrieve a point along a path

Move a GameObject to a certain location

Parameters:

  • point:Vector3 Vector3

    given a current location it makes the best approximiation of where it is along the path ratio-wise (0-1)

Returns:

Float:

float of ratio along the path

Example:

ratioIter = ltSpline.ratioAtPoint( transform.position );

Properties

distance distance of the spline (in unity units)

Float

Defined in LeanTween.cs:2790