I want to make a car lift but I have no idea how to make it work
This is my script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CarLift : MonoBehaviour
{
public GameObject min;
public GameObject max;
public GameObject[] Car;
int i;
public float liftSpeed = 20f;
Rigidbody2D rb;
void Start()
{
rb = GetComponent<Rigidbody2D>();
}
public void pointerDownGreen()
{
FindObjectOfType<AudioManager>().Play("carLift");
Debug.Log("DownGreen");
}
public void pointerDownRed()
{
FindObjectOfType<AudioManager>().Play("carLift");
Debug.Log("DownRed");
}
public void pointerUp()
{
FindObjectOfType<AudioManager>().Stop("carLift");
Debug.Log("Up");
}
private void OnTriggerEnter(Collider trigger)
{
foreach (GameObject Cars in Car)
{
if()
{
break;
}
else
{
continue;
}
}
}
}
I want to make that the car stop when it touches GameObject Min or Max but i don’t now how to make the car to move up and down
The car should move when you press a button (upBtn and downBtn).