Resizing

We have an example BPMC_M2Example_ResizingComponent, which demonstrates how to resize the character in a way that translates to the animated crowd

The example map has some "resize zones", which can grow or shrink player characters that enter The character in the blue volume has been doubled in size, and the character in the green volume has halved.

Features (and limitations)

  • Players in LOD0 or the crowd will be able to visually change size

  • Players in the rendering LOD 0 will smoothly change size to their target size

  • Players in the crowd will instead snap to their target size.

  • The ScaleFactor variable is a background replicated variable, so is synced to all players, even those far away.

A note on performance:

  • The example map has a BP_ResizingZone, which demonstrates how the resizing functionality can be triggered

    • It resizes users to the the target ScaleMultiplier when entering the zone, and reverts the change when leaving.

    • There are a few more complex implementation details here, explained in the asset's event graph (e.g. why we don't just use the "overlap" event to trigger scaling up/down)

Implementation details

  • In our example BPMC_M2Example_ResizingComponent, we update a client auth, background replicated ScaleFactor float.

  • We apply that scale factor in the OnRep, applying it either immediately, or smoothly on tick.

    Each flow ultimately calls `ApplyScaleMultiplier to update the character's scale:

    • For LOD0 actors, scale is set using SetActorScale3D on the render target actor

      • NOTE: Since the render target actor can change when switching LOD level, we need to also remember to apply the scale multiplier, otherwise characters entering LOD0 will use whatever the last pooled scale was.

    • For crowd actors, there is a SetCrowdScale function, that applies the scale factor.

    • For the local character, we also modify their spring arm, so the camera zooms in/out appropriately

Last updated

Was this helpful?