Path Position Versus Distance

Hi all,

I have a dolly track camera that has an animation that increments the Path Position variable to move the camera along the track. When I use Path Units, as expected, the camera speeds up and slows down depending on the relative distances between its current and next waypoint. I was hoping, however, that I could use Distance, but it seems to be an actual world-unit distance and not a 0 …1 distance as I was hoping.

Since there is no easy way to tell how long the path is, it’s a bit frustrating trying to have the camera track with consistent movements (IE moving at a constant speed), since I have to guess and check for the right ending path distance. Am I going about this the wrong way? Would it be possible to, at least, add something that calculates the total distance of the path and displays it (perhaps in the Dolly Track object itself?)

Thanks!

You can get the length of the path:

CinemachinePathBase path;
float length = path.PathLength;
1 Like

@Gregoryl ,

Thanks for the lighting-fast response! I figured this was possible via script, but since I’m changing keyframes in the Timeline editor, it’d be nice to see what the value is–IE, it might be a nice addition to the Path’s inspector. I’ll go ahead and make the change on my end for convenience. Thanks!

1 Like

@Multithreaded_Games Thanks for your feedback. We’ve added a Path Length display to the inspector, and also took the opportunity to add a “Normalized” option to the Position Units selector in the Tracked Dolly component. Using this setting, the path position ranges from 0 to 1.

3328056--259320--upload_2017-12-19_16-13-16.png

@Gregoryl

Thanks so much for implementing this, appreciate it!

@Gregoryl Normalized means Distance Normalized, right? Because it could also be Path Units Normalized.

Yes, normalized distance

Is there anyway to turn a position (float) in from pathUnits to normalized units?

You can use path.FromPathNativeUnits() to convert from PathUnits to normalized.

1 Like