So right now I am stuck. I want to make a conveyor belt with my code but I ran inot this problem. I found this piece of code,
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ConveyorPush : MonoBehaviour {
public float speed = 3.0f;
void OnTriggerStay(Collider other) {
// Assign velocity based upon direction of conveyor belt
// Ensure that conveyor mesh is facing towards its local Z-axis
float conveyorVelocity = speed * Time.deltaTime;
Rigidbody rigidbody = other.gameObject.GetComponent<Rigidbody>();
rigidbody.velocity = conveyorVelocity * transform.forward;
}
}
I understand it but for some reason my trigger collider on the conveyor belt is not detecting a collision to a sprite with a non-trigger collider that has a rigid body.