mirror of
https://github.com/nothke/quality-control.git
synced 2024-11-13 22:33:43 +00:00
Working conveyor belt
This commit is contained in:
parent
5593d2a0da
commit
f506fbd6b4
File diff suppressed because it is too large
Load Diff
@ -4,24 +4,22 @@ using UnityEngine;
|
|||||||
|
|
||||||
public class ConveyorBelt : MonoBehaviour
|
public class ConveyorBelt : MonoBehaviour
|
||||||
{
|
{
|
||||||
|
Rigidbody _rb;
|
||||||
|
Rigidbody rb { get { if (!_rb) _rb = GetComponent<Rigidbody>(); return _rb; } }
|
||||||
|
|
||||||
public float speed = 1;
|
public float speed = 1;
|
||||||
|
|
||||||
List<ContactPoint> contactPoints = new List<ContactPoint>();
|
Vector3 startPosition;
|
||||||
|
|
||||||
private void OnCollisionStay(Collision collision)
|
private void Start()
|
||||||
{
|
{
|
||||||
Vector3 targetSpeed = speed * Vector3.forward;
|
startPosition = rb.position;
|
||||||
|
}
|
||||||
|
|
||||||
Vector3 vel = collision.relativeVelocity;
|
private void FixedUpdate()
|
||||||
|
{
|
||||||
int count = collision.GetContacts(contactPoints);
|
rb.position = startPosition;
|
||||||
|
Vector3 targetSpeed = speed * transform.forward;
|
||||||
if (collision.rigidbody)
|
rb.MovePosition(rb.position + targetSpeed * Time.deltaTime);
|
||||||
{
|
|
||||||
for (int i = 0; i < count; i++)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user