Unity provides standard spline asset,
use BGCurve only if Unity spline misses some feature
Math [Component]
Description
Math gives you the access to Math functions for the curve. Math always operate with world coordinates. Currently 4 functions are supported 1) getDistance() [total curves length], 2) getPosition() [point position on the curve], 3) getTangent() [curve's point tangent] 4) getPositionByClosestPoint() [point position (and optionally distance) on the curve, which is closest to a given point])
Which fields to calculate ('Position' Or 'Position With Tangent'). Position only is approximately 1.8x times faster, so if you do not need tangents, keep it PositionsOnly.
mathType
Type of spline's approximation. 1) Base- split every section uniformly to N even parts. 2) Adaptive- split every section non-uniformly based on spline's curvature. This can greatly reduce the number of required points. See more details in "For Programmers" section.
sectionParts
Number of parts to split every section of the spline for Base mathType (approximation). More parts- more precise approximation and lesser performance.
tolerance
parameter to control Adaptive mathType (approximation). Lesser this parameter- more points are created and lesser performance.
usePositionToCalculateTangents
Use points positions to calculate tangents instead of formula. You absolutely need this parameter if you use snapping.
optimizeStraightLines
Do not split straight lines and use 2 points for such sections. Tangents may behave differently in this mode.
updateMode
Updating math takes some time and resources. You can fine-tune in which cases math is updated (for the sake of performance). 1) Always- always update then spline's changed 2) AabbVisible- update only if AABB (Axis Aligned Bounding Box) around points and controls is visible by any camera (including Editor's SceneView camera) 3) RendererVisible- update only if some renderer is visible 4) ForceEveryFrame- update even if spline's not changed. You need this mode then you use Unity Animation (which changes private fields and no events are fired)
rendererForUpdateCheck
Renderer for RendererVisible update mode. Any Game Object with some Renderer attached. Math will be updated only if this object is visible by any camera (including Editor's SceneView camera).
mathChanged
This is a standard Unity persistent event to be fired then math is recalculated. Math is recalculated then spline's changed. It's defined as mathChanged()
showHandles
This component supports handles in Scene View. Enable this flag to show handles. Handles are not interactive.
spheresScale
Adjust spheres scale. Each sphere represent point, calculated during spline's approximation.
spheresColor
Set spheres color.
spheresCount
The number of first N points (spheres) to show. The number is restricted for performance reason.