mirror of
https://github.com/nothke/quality-control.git
synced 2025-08-08 23:03:43 +00:00
Crane logic fixes
This commit is contained in:
@@ -52,7 +52,7 @@ public class CranePickDrop : MonoBehaviour
|
||||
magnet.strength = magnetStrength;
|
||||
|
||||
crane.testTgt = handlingBody.transform;
|
||||
if (Vector3.Distance(handlingBody.position, magnet.transform.position) < 1f)
|
||||
if (magnet.IsCloseTo(handlingBody, 2f))
|
||||
{
|
||||
crane.testTgt = dropTarget;
|
||||
state = State.Tansporting;
|
||||
|
@@ -17,14 +17,19 @@ public class SlidingCrane : MonoBehaviour
|
||||
public Transform testTgt;
|
||||
public Vector3 target;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
target = transform.position;
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (testTgt)
|
||||
target = testTgt.position;
|
||||
|
||||
|
||||
Vector3 localTarget = transform.InverseTransformPoint(target);
|
||||
xMotion.Update(Time.deltaTime);
|
||||
yMotion.Update(Time.deltaTime);
|
||||
|
||||
|
||||
Vector2 targetPlanar = new Vector2(localTarget.x, localTarget.z);
|
||||
|
||||
@@ -37,6 +42,9 @@ public class SlidingCrane : MonoBehaviour
|
||||
float x = Mathf.Lerp(-xRange, xRange, xMotion.progress);
|
||||
float y = yMotion.progress * yRange;
|
||||
|
||||
xMotion.Update(Time.deltaTime);
|
||||
yMotion.Update(Time.deltaTime);
|
||||
|
||||
yTransform.localPosition = new Vector3(0, 0, yMotion.progress * yRange);
|
||||
xTransform.localPosition = new Vector3(x, 0, 0);
|
||||
}
|
||||
|
Reference in New Issue
Block a user