using System.Collections; using System.Collections.Generic; using UnityEngine; namespace TrafficSimulation{ public class CarSitter : MonoBehaviour { public CarPool carPool; // Start is called before the first frame update void Start() { } // Update is called once per frame void Update() { if(gameObject.activeInHierarchy){ checkRotation(); } } void checkRotation(){ if(Vector3.Dot(gameObject.transform.up, Vector3.down) > 0.5){ Debug.Log("despawn car, because its turtleing!"); this.carPool.despawnCar(gameObject); } } } }