API Reference (Math)

This page is API reference for a curve's math (BansheeGz.BGSpline.Curve.BGCurveMathI). Class, which implements this interface give you an access to the set of different utility methods for spline approximation. Read more about this methods here Commonly, you want to use BGCcMath component, which implements this interface.

Method/Property Returns Description
GetDistance(int pointIndex = -1) float Returns spline's length. Optionally specify pointIndex to get a distance to specified point
CalcPositionByDistanceRatio(float distanceRatio, bool useLocal = false) Vector3 Calculate position by distance ratio.
CalcPositionByDistance(float distance, bool useLocal = false) Vector3 Calculate position by distance.
CalcTangentByDistanceRatio(float distanceRatio, bool useLocal = false) Vector3 Calculate tangent by distance ratio.
CalcTangentByDistance(float distance, bool useLocal = false) Vector3 Calculate tangent by distance.
CalcPositionAndTangentByDistanceRatio(float distanceRatio, out Vector3 tangent, bool useLocal = false) float Calculate position and tangent by distance ratio. Returns position
CalcPositionAndTangentByDistance(float distance, out Vector3 tangent, bool useLocal = false) float Calculate position and tangent by distance. Returns position
CalcSectionIndexByDistanceRatio(float ratio) int Calculate spline's section using distance ratio
CalcSectionIndexByDistance(float distance) int Calculate spline's section using distance
CalcPositionByClosestPoint(Vector3 point, bool skipSectionsOptimization = false, bool skipPointsOptimization = false) Vector3 Calculate spline's world point position by a point, which is closest to a given point.
CalcPositionByClosestPoint(Vector3 point, out float distance, bool skipSectionsOptimization = false, bool skipPointsOptimization = false) Vector3 Calculate spline's world point position and distance by a point, which is closest to a given point.
CalcPositionByClosestPoint(Vector3 point, out float distance, out Vector3 tangent, bool skipSectionsOptimization = false, bool skipPointsOptimization = false Vector3 Calculate spline's world point position, distance and tangent by a point, which is closest to a given point.
[int sectionIndex] BGCurveBaseMath.SectionInfo Returns information about spline's section.
Recalculate(bool force = false) void Force math internal data to be recalculated. Usually math recalculates its data (in case of curve is changed) once per frame at Update or LateUpdate methods. If you need all the changes to take effect immediately, call this method