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
  snap to the curve created by the curvy splines segment points ShiroeYamamoto 1 2 Yesterday, 10:23 PM
Last Post: _Aka_
  Curvy Line Renderer for UI Spline? gekido 1 1 Yesterday, 10:12 PM
Last Post: _Aka_
  Get position of all control points for a spline gekido 1 2 Yesterday, 10:08 PM
Last Post: _Aka_
Bug Changing spline connection in inspector causes splines to revert to defaults lacota 3 6 03-18-2024, 07:55 PM
Last Post: _Aka_

Forum Jump: