Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to get Split Length to match spline segment length?
#4
Hello,

Thank you for your message, and explaining how Split Length works.

I think I will try to improve the method I am using in my second post. Basically, it sounds similar to your suggestion, as I loop through control points in the spline, and only generate a mesh between neighbouring control points.

This way each mesh is exactly as long as the segment. However, most of the meshes don't have a collider that matches their mesh. They have a mesh collider component, but the mesh they use for this is actually the mesh of the last segment in the spline. So the last mesh in the spline has many mesh colliders positioned over it - each one a component of each of the other mesh game objects in the spline.

The only way I managed to get this working, is to set createMesh.AutoUpdateColliders = false, and to add the mesh colliders myself:

Code:
            GameObject meshSegment = createMesh.SaveToScene(fromCP.gameObject.transform);

            MeshCollider segmentCollider = meshSegment.transform.GetChild(0).gameObject.AddComponent<MeshCollider>();

            segmentCollider.convex = true;

Is this an ok fix for this?
Reply


Messages In This Thread
RE: How to get Split Length to match spline segment length? - by dromo - 07-21-2022, 01:02 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Best way to duplicate a spline with an offset Kapistijn 8 1,304 04-12-2026, 03:18 PM
Last Post: _Aka_
Smile Constant speed along a spline? tfishell 1 648 11-13-2025, 11:32 AM
Last Post: _Aka_
  SplineController Ignores Follow-Up and Chooses Wrong Spline Josenildo 7 4,439 07-29-2025, 09:15 PM
Last Post: _Aka_
  Curvy Line Renderer for UI Spline? gekido 7 6,164 07-13-2025, 07:11 PM
Last Post: _Aka_

Forum Jump: