private void getObjects() { //else aIcontroller = GetComponent<AIcontroller>(); CarEffects = GetComponent <carEffects>(); rigidbody = GetComponent <Rigidbody>(); wheelColliders = gameObject.transform.Find("wheelColliders").gameObject; wheelMeshes = gameObject.transform.Find("wheelMeshes").gameObject; wheels[0] = wheelColliders.transform.Find("0").gameObject.GetComponent <WheelCollider>(); wheels[1] = wheelColliders.transform.Find("1").gameObject.GetComponent <WheelCollider>(); wheels[2] = wheelColliders.transform.Find("2").gameObject.GetComponent <WheelCollider>(); wheels[3] = wheelColliders.transform.Find("3").gameObject.GetComponent <WheelCollider>(); wheelMesh[0] = wheelMeshes.transform.Find("0").gameObject; wheelMesh[1] = wheelMeshes.transform.Find("1").gameObject; wheelMesh[2] = wheelMeshes.transform.Find("2").gameObject; wheelMesh[3] = wheelMeshes.transform.Find("3").gameObject; centerOfMass = gameObject.transform.Find("mass").gameObject; rigidbody.centerOfMass = centerOfMass.transform.localPosition; }
private void getObjects() { CarEffects = GetComponent <carEffects>(); rigidbody = GetComponent <Rigidbody>(); wheelColliders = GameObject.Find("wheelColliders"); wheelMeshes = GameObject.Find("wheelMeshes"); wheels[0] = wheelColliders.transform.Find("0").gameObject.GetComponent <WheelCollider>(); wheels[1] = wheelColliders.transform.Find("1").gameObject.GetComponent <WheelCollider>(); wheels[2] = wheelColliders.transform.Find("2").gameObject.GetComponent <WheelCollider>(); wheels[3] = wheelColliders.transform.Find("3").gameObject.GetComponent <WheelCollider>(); wheelMesh[0] = wheelMeshes.transform.Find("0").gameObject; wheelMesh[1] = wheelMeshes.transform.Find("1").gameObject; wheelMesh[2] = wheelMeshes.transform.Find("2").gameObject; wheelMesh[3] = wheelMeshes.transform.Find("3").gameObject; //waypoints waypoints = GameObject.FindGameObjectWithTag("path").GetComponent <trackWaypoints>(); currentWaypoint = gameObject.transform; nodes = waypoints.nodes; centerOfMass = GameObject.Find("mass"); rigidbody.centerOfMass = centerOfMass.transform.localPosition; }