mirror of
https://github.com/nothke/quality-control.git
synced 2024-11-13 22:33:43 +00:00
33 lines
831 B
C#
33 lines
831 B
C#
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);
|
|
}
|
|
}
|