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:
Is this an ok fix for this?
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?