I’m a beginner in learning unity and #C so my question may be very basic. I write the below simple code for my object to move toward from its first position to the target position. Now, I want to make this object fall down (into a container) when it meets the target position which is the end of a conveyor.
Many thanks in advance for our help.
public Rigidbody rb;
public Transform target;
public float speed;
void Start()
{
}
void FixedUpdate()
{
Vector3 a = transform.position;
Vector3 b = target.position;
transform.position = Vector3.MoveTowards(a, b, speed);
}
}