methusalah / SplineMesh

A Unity plugin to create curved content in real-time with bézier curves
https://twitter.com/dumas181
MIT License
1.05k stars 104 forks source link

How to draw a standard arc with an angle #52

Open 666wwx opened 2 years ago

666wwx commented 2 years ago

Excuse me, can you draw a standard arc from an angle?

methusalah commented 2 years ago

There is no script to do such a thing in SplineMesh and you will have to write a little script to do the math.

The nodes positions are quite easy to compute, you just need to rotate a point around a pivot.

For the nodes control points (wrongly named Direction in SplineMesh), the direction vector is the tangent of the arc : just get the right angle of the segment pivot/node.

The distance of the control point will determine the curvature of your arc. There must be an exact, mathematical value for that (which depends on the length of the arc), but I don't know it.

666wwx commented 2 years ago

Thank you very much. I'll try to write it according to your ideas.