06-19-2018, 05:31 PM
Hi,
Here is how I would have coded it:
(the following is pseudo code, but should be clear enough so you can easily implement the real thing)
Note that I used AbsolutePosition instead of InitialPosition, because InitialPosition is deprecated in the latest Curvy version. If you want to stick to old Curvy versions, then you can use InitialPosition while setting Position mode to Absolute.
I hope this helps
Here is how I would have coded it:
(the following is pseudo code, but should be clear enough so you can easily implement the real thing)
Code:
float splineLength = yourSpline.Length;
float vehiculesLength = //the sum of all your vehicules' length;
float totalSpaceBetweenVehicules = splineLength - vehiculesLength;
Assert.IsTrue(totalSpaceBetweenVehicules > 0); // don't forget to handle the case where this is not true
float perVehiculeSpacing = totalSpaceBetweenVehicules / (vehiculesCount - 1);
float currentDistance = 0;
foreach (var vehicule in vehicules)
{
vehicule.CurvyController.AbsolutePosition = currentDistance;
currentDistance += (vehicule.VehiculeLength + perVehiculeSpacing);
}
I hope this helps
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.