TobiasWehrum / unity-utilities

A collection of Unity3D scripts I've been sharing between projects - open source, fully commented and with examples.
MIT License
274 stars 27 forks source link

Bezier curve stuff #5

Closed oxysoft closed 8 years ago

oxysoft commented 8 years ago

In one of my projects, it was useful to define and edit bezier curves inside the editor, and assign data to each of these points that we could interpolate over etc. It actually surprises me that Unity has NOTHING in terms of bezier curves and splines because they are incredibly useful in game development. If you'd be interested in adding some support for something like that in this suite, I can share some older code with the features listed above. The code is not pretty so it should only serve as a reference.

I had also implemented an efficient algorithm that I invented that lets you find the point on a bezier spline that is closest to an arbitrary P point in the world. This is useful for games with cameras on rail and whatnot. I can definitely share that as well if you're interested in bezier curve stuff

I used this http://catlikecoding.com/unity/tutorials/curves-and-splines/ as a base and it works fairly well, but the editing of curves could be better as well as other design decisions made in the API.

TobiasWehrum commented 8 years ago

Bezier curves with proper editing is more an entire package on its own - and something I don't know enough about, sorry!

I'd love to see your bezier spline polnt finding algorithm though! If you are still willing to share it, you can reach me at Tobias.Wehrum@dragonlab.de.