LocalPositionTweens
A dedicated position batch for many Transforms. Add uses local coordinates and AddWorldPosition uses world coordinates.
public sealed class LocalPositionTweens : IDisposableLocalPositionTweens.cs · L11Tick 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 = 16intNumber 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
targetTransformTransform whose position the batch updates.toVector3End value.secondsfloatDuration in seconds.ease = Easing.OutQuadEasingEasing 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
targetTransformTransform whose position the batch updates.toVector3End value.secondsfloatDuration in seconds.ease = Easing.OutQuadEasingEasing 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
deltaTimedoubleSeconds to advance from the preceding update.
Dispose
Release the native storage owned by this batch.
public void Dispose()
MeatMotion