# Resizing

{% hint style="success" %}
verified: 2025-11-19 version: v39
{% endhint %}

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

<figure><img src="/files/6PxgB1dOrfKGto0bRPbD" alt=""><figcaption><p>The example map has some "resize zones", which can grow or shrink player characters that enter<br>The character in the blue volume has been doubled in size, and the character in the green volume has halved.</p></figcaption></figure>

## 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.

{% hint style="warning" %}
**A note on performance:**

This resizing implementation is not intended for, and should not be used at high frequency in large scale events.

Since the scale factor in this example is replicated on the background, it runs on every client. For small scale events this is no problem, but when scaling to 18k+, any such property needs to be handled with care, especially when writing logic in BPs. If thousands of OnReps are triggered on the same frame, there will likely be a small hitch, even if each isn't doing all that much.
{% endhint %}

* 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)

    <figure><img src="/files/kf2QTRslALS12zHSLLRJ" alt=""><figcaption></figcaption></figure>

## Implementation details

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

  <figure><img src="/files/HmGSlhm7FDHBdjyjrwJ0" alt=""><figcaption></figcaption></figure>
* 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:

  <figure><img src="/files/Roghj5EGoneQrENIkjHP" alt=""><figcaption></figcaption></figure>

  * 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.

      <figure><img src="/files/pAbe2cQIaDNNH2txGQcn" alt=""><figcaption></figcaption></figure>
  * 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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.msquared.io/creation/unreal-development/features-and-tutorials/the-m2-example-plugin/resizing.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
