Can anyone suggest a simple and functional package that can do an editable, bendable, spline cylinder? I only need like 3-5 points, and need automatic smoothness between points. It sounds simple and like it should be an easy thing. However most of the spline packages out there are intended for the splines to be paths or basis data. I just want a bendable cylinder, to make a cable out of in VR.
Sebastian Lague’s Path Creator is great, but its runtime editing is limited.
I’m doing something similar right now (in my case an editable track at runtime) and using Sebastian Lague’s package. I just took the example RoadMeshCreator from the package and adapted it to my needs.
Good to know, thanks. I gave Path Creator another look after your recommendation and realized what was tripping me up.
I just wanted the three main control points, without the bezier curve control points. So, intuitively, I thought that I could talk to indices 0,1,2… well, it turns out that he stuffs the bezier curve control points into the list, so if you want to edit a three point curve with automatic points, you need to talk to indices 0, 3, and 6! That skips the curve controls.
Once I realized this it worked great. Thanks again for the nudge.
Hey @PraetorBlue did you figure out the right way to get the spline to respond to edits at runtime? I’m seeing a behavior where calling MovePoint won’t take effect until the PathCreator gameobject has been selected in editor. There’s this odd setup where PathCreator.initialized is set to true by default, is serialized/hidden, and holds up the notification events. When we select the gameobject, OnEnable fires and does that init. Seems like he was assuming editor usage here. I’m unraveling it but wondering if you already did all this. Thanks.
Oh I scrapped the PathCreator entirely. I just have a few points that I’m keeping track of (start/end and 2 control points) - feeding into a BezierPath, from which I create a VertexPath, and from there I copied/modified the mesh generation code from the RoadMeshCreator to create the actual mesh.
The PathCreator class was clearly designed just for creating paths at edit time, so it’s more useful as a reference than to try to use it directly at runtime IMO.
@PraetorBlue oh nice, that is smart. I was able to beat PathCreator into working. It wasn’t too bad. Just made that initialized parameter in PathCreator.cs nonserialized/private and had it start as false. That made everything start up properly, as it was normally waiting for OnEnable to fire in the editor.
Then his CylinderMeshCreator just needs to fire PathUpdated() outside of his editor flow. I think this will work for me.
As far as the Hose system, I totally forgot about that! That Megafiers package has so many things in it I always forget to look. It’s not quite perfect for my use case since I want explicit control over the midpoints, not just the start and end. But it’s a cool thing and I’ll remember it for that future. Cheers @MikeUpchat