This sample demonstrates how you can use a DistanceBasedUpdateRateModifier
component to improve performance by updating the simulation less often when the character is far away from the camera.
The effect is a bit hard to see due to the frame rate of the video and how small the character gets on screen, but that's the whole point: there's no need to update the simulation every frame if you can barely tell the difference.
Here's a breakdown of what's happening in that video:
- According to the information panel in the bottom right, the camera starts about 1.8m away from the character.
- The
Near Range
is3
and the camera is closer than that so the update rate at the full 50 (defined in theFlexiMotion
component). - When the camera zooms out past
3
, the update rate gets lower. - As the distance approaches the
Far Range
of15
, the update rate approaches the minimum value (Minimum Update Rate Multiplyer x Updates Per Second
). - Once the distance exceeds
15
, theFlexiMotion
component is disabled entirely.
Also note that the character's Action On Disable is set to Recenter
to avoid causing a violent jump if the character moves before the simulation is re-enabled.