MeatMotion

LocalPositionTweens

A dedicated position batch for many Transforms. Add uses local coordinates and AddWorldPosition uses world coordinates.

Namespace
MeatMotion
Assembly
MeatMotion

Jump to members

public sealed class LocalPositionTweens : IDisposable
LocalPositionTweens.cs · L11

Tick a position batch

Add using MeatMotion; and using UnityEngine; and put this inside the target MonoBehaviour. The destination is two units to the right of the current local position.

var start = transform.localPosition;
using var positions = new LocalPositionTweens();
positions.Add(transform, start + Vector3.right * 2f, 1f, Easing.Linear);
positions.Tick(0.5);

Members

Count

Number of position tweens currently in the batch.

public int Count { get; }

LocalPositionTweens

Allocate persistent native storage with the requested initial capacity. Call Dispose after use.

public LocalPositionTweens(int capacity = 16)
Parameters
capacity = 16
int Number of entries to reserve.

Add

Move from the current local position to the destination. A zero duration writes the destination immediately.

public void Add(Transform target, Vector3 to, float seconds, Easing ease = Easing.OutQuad)
Parameters
target
Transform Transform whose position the batch updates.
to
Vector3 End value.
seconds
float Duration in seconds.
ease = Easing.OutQuad
Easing Easing function mapping normalized time to progress.

AddWorldPosition

Move from the target's current world position to the destination.

public void AddWorldPosition(Transform target, Vector3 to, float seconds, Easing ease = Easing.OutQuad)
Parameters
target
Transform Transform whose position the batch updates.
to
Vector3 End value.
seconds
float Duration in seconds.
ease = Easing.OutQuad
Easing Easing function mapping normalized time to progress.

Tick

Advance the batch by a nonnegative delta and retire finished or destroyed targets.

public unsafe void Tick(double deltaTime)
Parameters
deltaTime
double Seconds to advance from the preceding update.

Dispose

Release the native storage owned by this batch.