Skip to content

A library for Unity to support creating and modifying curves in the editor.

License

MIT, MIT licenses found

Licenses found

MIT
license.txt
MIT
Siccity_license.txt
Notifications You must be signed in to change notification settings

jeffcampbellmakesgames/unity-curves

Repository files navigation

JCMG Curves

openupm GitHub issues GitHub Twitter Follow

About

JCMG Curves is a 3D Bezier curve library focused on ease of use in both its API and Unity Editor integration.

Example Curve

Overview

JCMG Curves offers a MonoBehaviour and ScriptableObject curve class which can be modified in the Unity Editor and/or inspector. A Bezier curve can be created as either a MonoBehaviour component in the form of Bezier3DSpline or as a ScriptableObject in the form of Bezier3DSplineData. Both have the same common interface as defined by IBezier3DSplineData and IReadOnlySplineData and offer methods for retreiving the position, rotation, and unit-length local vectors for Up, Left, Right, etc... for a point along the spline based on either a normalized value [0-1] of its total length or on a set distance.

The primary difference between these two options is that Bezier3DSpline' Transform is taken into account when accessing its APIs and so the positions, rotations, and vectors it return are transformed based on its Transform's position and rotation, while all similar APIs for Bezier3DSplineData do not and are effectively in the World coordinate space. It is easy to copy spline data between these two types or others of the same type by using the Copy and Paste buttonss on their inspector.

This library was originally cloned from https://github.com/Siccity/Bezier3D and has been refactored and enhanced to include a simpler API, better readability, additional features, and several bug fixes. One of the key features I wanted to maintain that distinguished it from other similar libraries was the way that it cached and stored points along the curve so that it was possible to get a position or rotation along the curve at a set distance of the curve's total length rather than a normalized value of 0-1 over the entire length. This makes it possible to navigate along the spline based on a constant speed and is not affected by Bezier segments of differing lengths.

Installing JCMG Curves

Using this library in your project can be done in three ways:

Install via OpenUPM

The package is available on the openupm registry. It's recommended to install it via openupm-cli.

openupm add com.jeffcampbellmakesgames.curves

Install via GIT URL

Using the native Unity Package Manager introduced in 2017.2, you can add this library as a package by modifying your manifest.json file found at /ProjectName/Packages/manifest.json to include it as a dependency. See the example below on how to reference it.

{
	"dependencies": {
		...
		"com.jeffcampbellmakesgames.curves" : "https://github.com/jeffcampbellmakesgames/unity-curves.git#release/stable",
		...
	}
}

Install via classic .UnityPackage

The latest release can be found here as a UnityPackage file that can be downloaded and imported directly into your project's Assets folder.

Usage

To learn more about how to use JCMG CUrves, see here for more information.

Contributing

For information on how to contribute and code style guidelines, please visit here.

Support

If this is useful to you and/or you’d like to see future development and more tools in the future, please consider supporting it either by contributing to the Github projects (submitting bug reports or features and/or creating pull requests) or by buying me coffee using any of the links below. Every little bit helps!

ko-fi

About

A library for Unity to support creating and modifying curves in the editor.

Resources

License

MIT, MIT licenses found

Licenses found

MIT
license.txt
MIT
Siccity_license.txt

Stars

Watchers

Forks

Packages

No packages published

Languages