- Home /
creating path e moving object on it
Hi, I'd like to create a path and move an object on it (from c# code) I know waypoints but I don't know how to do bezier courves when needed I've red that System.Drawing is not usalble with Unity3d is it true? I did the trick in java with GeneralPath class, because I have to build path and to know points? Do you have a solution? thanks
Answer by testure · Sep 25, 2011 at 07:34 PM
personally, I just use a simple catmull-rom algorithm to subdivide a spline between nodes.
all of my code is NDA, so I can't share it with you, but this could help you get started:
it's worth noting that I don't subdivide splines at runtime- that would be pretty slow. I wrote an editor class that allows me to subdivide and tweak my splines in the editor, and the resulting 'smoothed' spline is stored in a serialized list that can be accessed at runtime.
also, for moving an object on a path, I always just use iTween's $$anonymous$$oveTo or PutOnPath functionality.