Sliding crane

This commit is contained in:
nothke
2024-08-17 13:38:26 +02:00
parent 87a0195f91
commit 0d1c168736
9 changed files with 1548 additions and 2 deletions

View File

@@ -0,0 +1,32 @@
using Nothke.Utils;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SlidingCrane : MonoBehaviour
{
public InertialInterpolator xMotion = InertialInterpolator.Default();
public InertialInterpolator yMotion = InertialInterpolator.Default();
public Transform xTransform;
public Transform yTransform;
public float yRange = 10;
public float xRange = 5;
void Start()
{
yMotion.AccelerateTo(1);
xMotion.AccelerateTo(1);
}
// Update is called once per frame
void Update()
{
xMotion.Update(Time.deltaTime);
yMotion.Update(Time.deltaTime);
yTransform.localPosition = new Vector3(0, 0, yMotion.progress * yRange);
xTransform.localPosition = new Vector3(xMotion.progress * xRange, 0, 0);
}
}