Lerp
The companion follows the anchor at a distance. They will move as fast as they need to in order to stay within the desired distance.
Lerp motion operate by this logic, using a lerp
variable between 0 and 1.
- If the companion is too far (>
Max
) from the anchor position, teleport to the anchor. - If the companion is far enough (>
Min
) from the anchor position,- Record companion current position as start.
- Pick an end position based on the anchor.
- Enter lerping state.
- When start and end positions are set, increase
lerp
by value relative to elapsed game time, then calculate companion position withstart + (end - start) * lerp
.- If
Velocity
is 0 or greater, calculate the lerp value by the velocity instead.
- If
- Once
lerp
reach 1 (and thus the companion reached the end position), exit lerping state. - This completes 1 lerp step, and the companion will try to initiate new lerp state in the next game update tick.
Args
Property | Type | Default | Notes |
---|---|---|---|
Min |
float | 96 | Min distance from anchor, the companion does not move until they are this far from the anchor. |
Max |
float | 1280 | Max distance from anchor, if the companion is farther away than this, teleport. This argument is not speed, but rather how often the new Lerp target is to be checked. A larger number makes the companion takes longer strides. |
Rate |
float | 400 | Miliseconds needed to complete 1 lerp, higher number makes companion take larger but slower lerp steps. |
Pause |
float | 0 | Pause between picking next position to lerp to. |
MoveSync |
bool | false | When true and anchor is Owners, only allow companion to move when the player moves. |
MoveSyncAll |
bool | false | When true, only allow companion to move when the player moves. |
Jitter |
float | 0f | Add randomness to movement, if greater than 0 and AlwaysMoving is true, the companion will randomly move around the anchor while within minimum range. |
Velocity |
int | -2 | Limit the companion's velocity to a constant number, rathern than variable with lerp. Has special values -2 (unlimited), and -1 (follow the owner's velocity, when anchored to owner). |
NoOverlap |
bool | true | When true and when the player has multiple trinkets with companions equipped, avoid overlapping with any other companion. |