Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Unity Cubic Bézier Curve

Sample Gif


Unity Cubic Bézier Curve is a project used to demonstrate a 3D bézier curve in Unity using line renderers.

Version: 1.0.0

Author: Adrian Miasik

License: GPL-3.0

Contributor(s): -
Want to help? If you're interested in contributing to the project, please send me a message / reach out:

Author Notes

Fun fact: This project inspired me to create unity-shaders

Bulk Logic

        /// <summary>
        /// Returns a 3D position on the provided cubic bezier curve at a specific time (0-1)
        /// </summary>
        /// <param name="_p0">Start Anchor</param>
        /// <param name="_p1">Start Handle (tangent)</param>
        /// <param name="_p2">End Handle (tangent)</param>
        /// <param name="_p3">End Anchor</param>
        /// <param name="_time">A number between 0-1. 0 representing P0 and 1 representing P3</param>
        public static Vector3 GetPointOnCubicBezierCurve(Vector3 _p0, Vector3 _p1, Vector3 _p2, Vector3 _p3, float _time)
            float _term = 1 - _time;
            float _termSquared = _term * _term;
            float _timeSquared = _time * _time;
            float _termCubed = _termSquared * _term;
            float _timeCubed = _timeSquared * _time;
            // Formula Source:
            return _p0 * _termCubed + 
                   _p1 * (3 * _termSquared * _time) +
                   _p2 * (3 * _timeSquared * _term) +
                   _p3 * _timeCubed;