2D spline utility for Unity
Note: I have stopped using Unity and so am not maintaining this library any more.
Unity Spline2D is a free 2D simple spline library for Unity.
t
alone can result in varied
speeds along the curve if your points are not equidistant. With Spline2D you
can ask for a position a specific distance along the curve instead, and therefore
traverse the curve at a known speed regardless of the structure of the curve.Curvature
property to change the shapeSpline2D.cs
and Spline2DComponent.cs
anywhere you likeSpline2DInspector.cs
in an Editor
subfolder somewhere.Spline2D
and call its
AddPoint methods etc to build the splineSpline2DComponent
as a regular
Unity component. There is a inspector with buttons to add/remove points, and
you can select points and drag them around to change the curve.The MIT License (MIT)
Copyright (c) 2016-2019 Steve Streeting
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.