Taking fixed distance steps down dolly path

Hi all, I’m working on a VR project and interested in using the dolly path of Cinemachine to move the player down a set route.

The issue with doing this in VR is movement can cause nausea, so we want to move at a set distance per frame/tick/second.

Simply adjusting the position (m_PathPosition), or calling EvaulatePosition(x) from CinemachinePath.cs to return a vector, don’t give the desired results as the vector returned is affected on how much the spline/path is curved.

Thanks,

David

Yes, the paths are cubic curves and the relationship between path position and arc length is a complex one. Out-of-the-box, Cinemachine does not provide a method for locating a point on the path at a specific arc-distance along the path.

You have a couple of options here:

  • Replace the CinemachinePath implementation with another one that is more appropriate for your needs. This is fairly straightforward: CM demands only that your implementation inherit from CinemachinePathBase. Use your new path in the TrackedDolly.
  • Add a method to the existing path implementation to return the path position of a point at a specific distance along the path. Look at CinemachinePathBase for the implementation of FindClosestPoint(). That might serve as a model for your new method. This will likely be computationally expensive, especially if you want high accuracy. You can probably speed this up by pre-computing an LUT.

@Percy-Pea Have a look at this: Constant speed on Dolly Track - Unity Engine - Unity Discussions