fix: added missing types for new primitives
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
using Engine.Core;
|
||||
|
||||
namespace Engine.Systems.Tween;
|
||||
|
||||
public static class TweenRay3DExtensions
|
||||
{
|
||||
private static readonly BoxedPool<Ray3D> boxedRay3DPool = new(2);
|
||||
|
||||
public static ITween TweenRay3D(this Ray3D initialRay3D, ITweenManager tweenManager, float duration, Ray3D targetRay3D, System.Action<Ray3D> setMethod)
|
||||
{
|
||||
Boxed<Ray3D> boxedInitial = boxedRay3DPool.Get(initialRay3D);
|
||||
Boxed<Ray3D> boxedTarget = boxedRay3DPool.Get(targetRay3D);
|
||||
|
||||
ITween tween = tweenManager.StartTween(duration,
|
||||
t => setMethod?.Invoke(
|
||||
new Ray3D(
|
||||
boxedInitial.Value.Origin.Lerp(boxedTarget.Value.Origin, t),
|
||||
boxedInitial.Value.Direction.Lerp(boxedTarget.Value.Direction, t).Normalized
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
tween.OnComplete(() =>
|
||||
{
|
||||
boxedRay3DPool.Return(boxedInitial);
|
||||
boxedRay3DPool.Return(boxedTarget);
|
||||
});
|
||||
|
||||
return tween;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user