Skip to content

vvrvvd/Unity-Spline-Editor

Repository files navigation

Unity Spline Editor

Unity 2020.1 openupm License: MIT

Table Of Contents

Introduction

Unity Spline Editor is an open-source tool for creating and managing cubic bezier curves in Unity Editor.

The tool was written to bring cubic bezier splines to Unity. The tool let you do the basic operations like adding, removing or splitting curves but also provides you with options to factor, simplify, draw or cast splines to camera view. You can also adjust how splines are displayed in the editor through settings window.

Features

  • Separate tools window for Spline Editor
  • Creating and managing cubic bezier splines in Scene View
  • Four modes for control points: Free, Aligned, Mirrored and Automatic
  • Splitting curves by split point value
  • Quick factoring and simplifying splines
  • Normals editor
  • Casting splines to either self, custom transform or camera using Physics Raycast
  • Casting control points to current mouse position using Physics Raycast
  • Drawer tool for drawing splines in Scene View
  • Three buttons layouts types: Image, Text and Image & Text
  • Adjustable editor settings (colors, sizes etc.)
  • Adjustable shortcuts through Unity Shortcuts manager
  • Example scripts for generating meshes from splines and using line renderers

System Requirements

Unity 2020.1 or newer.

Dependencies

Burst

Installation

  1. The package is available in Unity Package Manager via git URL. Follow up this Unity page for detailed instructions. Git URL:
https://github.com/vvrvvd/Unity-Spline-Editor.git#upm
  1. You can also install Spline Editor by simply downloading repository zip file and copying Assets folder content to your Unity project.

Overview

Spline Editor Window

Editor window can be opened by going to Window->Spline Editor on the Unity toolbar. Spline can be edited by adding, removing or splitting curves. Additionaly every control point has four modes that can influence a neighbour control point. When spline is looped the first and the last points are treated as the same point so they share the same position and mode (keep in mind that they are still two distinct points). Splines can also be quickly factored or simplified by adding or removing mid points from them.

Normals Editor

Spline points have normals that can be rotated along spline tangents. There is an option to flip normals or rotate all the normals by global angle.

Drawer Tool

Drawer tool lets you freely draw spline in the scene view. Use additional parameters like smoothing acute angles or segment length to adjust the tool to your needs.

Settings

Settings can be accessed by going to Edit->Project Settings->Spline Editor on the Unity toolbar or by clicking on a gear icon in the right corner of Spline Editor window.

Examples

Mesh Generator

Add Spline Mesh component on scene to generate mesh from Bezier Spline.

It is located in Samples/Mesh Generator folder.

Line Renderer Spline

To visualize spline using Line Renderer, add Line Renderer Spline component on scene.

It is located in Samples/Line Renderer folder.

License

MIT