- Home /
draw curved line between waypoints - like ongizmodrawline?
In the editor, I want to draw curved connections between waypoints, like a spline I suppose but does not need to be exact for an ai to follow, just a visual representation while editing, the AI will just go from waypoint to waypoint in code, but how can I just create the appearance of a curved line in the editor scene window? For the time being I am just using extra waypoints in between with ongizmodraw() lines between them.
Im thinking an empty with a script that has two transforms, and just draws a curved (maybe lerped? bezier?) line between them.
Like this:
Things I have tried and didnt work for me yet:
And that seems nice, but pops tons of warning in the editor and doesnt draw correctly :/
another thing I found:
http://forum.unity3d.com/threads/30826-What-s-wrong-with-this-code
Check "Andeeeee"s post - problem here is I don't know JS like I do C# so this will be challenging to understand for me...because I cant get it converted to C#...
Neither of those would work properly for me. Anyone have a better idea for me?
Answer by MD_Reptile · Dec 04, 2012 at 05:47 PM
Ok sort of kind of solved this with SWS (Simple Waypoint System) which is awesome. I mean I went from barely getting a couple few waypoints by hand a minute, to several waypoints, with smooth curves between EASILY and I am working on getting switched completely over to this system of waypoints, and working off that from now on.
And umm, another way I found was by using the scripts I found here:
And I had to change the actual PNG files to have bigger canvas because they were smaller than 8x8, so made all three 11x11 to be on the safe side, now it works! pops tons of warnings still but does work. It was not good enough for my purposes, so I opted for the SWS in the asset store, and it fits my needs well.
Answer by Graham-Dunnett · Dec 04, 2012 at 04:14 PM
I'd start with the example here:
http://docs.unity3d.com/Documentation/ScriptReference/Handles.DrawBezier.html
In your case, the problem will be knowing what the normals need to be.
@GrahamDunnett I saw that stuff but had assumed it only was for 2d bezier like on top of a gui and things like that - rather than a 3d bezier in the editor view.... Was i mistaken? I will look into this though, hopefully I come up with a better solution than the answer I posted, thanks for your input