I have the following code which is attempting to move an object along a path of 3 defined points using my interpretation (which is most likely the problem) of a Bezier curve. I am aiming longterm to change the EndPoint variables to the StartPoint variables to start a new curve from the end of this one.
I have solved the problem I had and this code now works for anyone who wants the same kind of effect.
The original question was a mistyping of the actual equation. I have changed the code so that it is now workable for anyone whom wants to adapt or use it.
answered Mar 06, 2010 at 11:15 PM
Well, just found this question, i know you got it to work but you've heard about Vector2 / Vector3 and functions?
That's are two versions: a quadratic bezier(one control point) and a cubic bezier(two control points). Each comes in two versions: Vector2 and Vector3.
The cubic equatation is transformed so you don't have those ugly (1-t)(1-t)(1-t). When you just multiply the brackets you get (1 + (-3 +(3-t)*t)*t) which looks even more ugly but with the other terms it resolves quite nicely ;)
answered Jul 25, 2011 at 06:40 PM
You can also use a tweening class like LeanTween to accomplish the same effect:
You can also chain different paths together very easily, like
And if you do not wish it to move at a constant speed you can pass an easing function like:
Just a hint for anyone out there who doesn't want to have to write their own bezier interpreting code!
answered Jul 21, 2013 at 12:27 PM
Do I just add this to a cube or sphere to text? What do I use for the transform? I tried adding the script to an empty game object. Then I draged the cube to the "Transform" zeroed the "Y' values. I get nothing. Help please.
answered Dec 21, 2010 at 10:25 PM