I am new to unity3d I want to make a path for animated object.
The path must be # elliptical circle # or # spring shape path #
I think there is a way to draw this path based on mathematics equation is it true?
or should I draw it using 3dmax.
Any help or related tutorial for this problem?
thanks
This is a helpful link for drawing a path w/ the mouse in game.
If you want to draw a spring programmatically you can use a Catmullrom or Bezier spline:
The inputs p0,p1,p2,p3 are the 4 control points for a particular segment. To see a spiral building example, the rest of this code can be found on my Github page. Look at BuildPath() in particular to see how to use those functions to build a continuous path. I dislike linking to external accounts but my usage example is a little too big for an SO answer.
If you want to draw an ellipse, the simplest way I can think is to solve the basic equation and build a ring of points:
That code assumes you have a horizontal major axis where ‘a’ is the radius of the horizontal major axis, ‘b’ is the radius of the vertical minor axis. Build the ellipse first along the X/Y axes and then apply whatever transform you wish to orient the ellipse.
Alternatively, and I don’t have code for this, you can use the general parametric equations to generate a rotated ellipse already off origin.