Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Mesh generation - orienting endpoints
I'm trying to use a generated mesh from a spline and seamlessly attach it to a prefab. The mesh generation is using the line shape so it's nothing terribly fancy. The attached image here shows the effect I'm seeing.


This is a single spline that loops around with the first CP being at the top of the junction point and the last being at the bottom. The generated mesh is the road that loops. The junction in the road is a prefab with a couple of different splines that run in varying directions so I can path accordingly.

What I'd like this to do is honour the orientation of the starting and ending control points so that I can get them to line up with the junction mesh.

Is this something that we can do with the current mesh generator? Or is this on the wishlist for the new one?

I've been able to tweak the splines to get it pretty close to joining up by mucking about with the TCB values but my goal is to be able to allow the user to draw roads in realtime and have it line up the way they would expect.
Did you tried to disable "AutoCP" and set the start and end CP to match the shape?
I assume you mean the Auto End Tangents setting on the spline? I've tried messing around with that to no positive end.

I've attached a sample project for you to see what I'm up to. I've stripped curvy from it so you will need to add curvy prior to loading it up.

.zip (Size: 2.34 MB / Downloads: 1)
Ok, I'll have a look. Give me a day or two, I'm quite busy right now...
Ok so I'm not really a math guy (which is why I bought curvy in the first place Wink ) but I've been doing some reading of my old text books and think I have an idea as to what's going on here. I think even though the continuity is 1, the first tangent calculation on the joined spline is actually the 'next' calculated point instead of the same tangent as the connection point. Maybe that's by design but I think it's causing grief with the generated mesh not lining up with the connected prefab mesh.

I switched to Bezier splines to give them a try and had better results but it still requires a bunch of manual tweaking during design time. I think what I'm looking for is a way to set the start/end tangents and have the handles automatically calculated based on some tolerance settings as to maximum curve angle or tangent variation or something like that.

Does that make sense at all?
To be honest I don't fully understand your setup, so I have to look into the example scene.
(10-14-2013, 07:44 PM)Jake Wrote: To be honest I don't fully understand your setup, so I have to look into the example scene.

Ok, I had a look (though I didn't see the prefab, I don't have Blender installed).

First, you're right, GetTangent isn't Connection-Aware right now. I'll add this to the next version. However, this would only solve half of your problem (the end tangent will be using the connected spline).

If you add CPs at the Start/End and disable "Auto End Tangents", you can freely "rotate" the starting tangent, this works good for me. Another idea: what about having Road as a closed spline and just rendering the mesh for a part of the spline?

Possibly Related Threads…
Thread Author Replies Views Last Post
  static mesh adndima 1 187 12-25-2020, 07:56 AM
Last Post: _Aka_
  Generate Mesh Spline from GameObject processor 4 682 10-01-2020, 11:00 AM
Last Post: _Aka_
  Mesh Lines - Horizontal and Vertical Edges Krypton 14 1,607 09-23-2020, 02:16 AM
Last Post: Krypton
  Generated mesh using bezier spline is not following the path accurately processor 3 643 08-25-2020, 04:39 PM
Last Post: _Aka_

Forum Jump: