mirror of
https://github.com/nothke/quality-control.git
synced 2025-08-30 15:33:44 +00:00
Sliding crane
This commit is contained in:
32
Assets/Scripts/SlidingCrane.cs
Normal file
32
Assets/Scripts/SlidingCrane.cs
Normal 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);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user