Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Mesh generation - orienting endpoints
#1
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.
Reply
#2
Did you tried to disable "AutoCP" and set the start and end CP to match the shape?
Reply
#3
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   curvytest.zip (Size: 2.34 MB / Downloads: 1)
Reply
#4
Ok, I'll have a look. Give me a day or two, I'm quite busy right now...
Reply
#5
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?
Reply
#6
To be honest I don't fully understand your setup, so I have to look into the example scene.
Reply
#7
(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?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Adjust radius of generated mesh via script? Shackman 1 3 03-26-2024, 01:12 PM
Last Post: _Aka_
  Not seeing mesh extended after following YT PaulM 1 3 02-02-2024, 12:01 PM
Last Post: _Aka_
  Trigger Zones along Spline Mesh dlees9191 1 5 01-05-2024, 10:18 AM
Last Post: _Aka_
  Get spline from generated mesh beartrox 1 5 11-27-2023, 12:30 PM
Last Post: _Aka_

Forum Jump: