The CubicBezier
method calculates a point on a cubic Bezier curve defined by two endpoints and two control points. This method is useful for creating smooth curves in 3D space.
The CubicBezier
method calculates a point on a cubic Bezier curve defined by two endpoints and two control points. This method is useful for creating smooth curves in 3D space.
To use the CubicBezier
method, provide the start point, end point, and two control points of the curve, along with a parameter t
that represents the position along the curve. The parameter t
should be a value between 0 and 1, where 0 corresponds to the start point and 1 corresponds to the end point.
Vector3 start = new Vector3(0, 0, 0); Vector3 end = new Vector3(10, 10, 0); Vector3 control1 = new Vector3(5, 0, 0); Vector3 control2 = new Vector3(5, 10, 0); float t = 0.5f; Vector3 pointOnCurve = Vector3.CubicBezier(ref start, ref end, ref control1, ref control2, t); // pointOnCurve now holds the position on the curve at t = 0.5