Quantcast
Channel: Questions in topic: "follow"
Viewing all articles
Browse latest Browse all 536

How can I make the CarController (a gameobject) follow my currentCar

$
0
0
My gameobjekt is called CarController. It spawns the choosen car into the scene (this works perfectly fine). Now I also want to let the CarController follow the currentCar trought the scene because if I would do that I would have a constant gameobject in the scene which follows the choosen car so that I can easily attach my scene camera to the CarController. Here is the code for the CarController: `using UnityEngine; public class CarController : MonoBehaviour { [SerializeField] private GameObject[] spaceshipModels; private void Awake() { ChooseStarshipModel(SaveManager.instance.currentStarship); } private void ChooseStarshipModel(int _index) { Instantiate(spaceshipModels[_index], transform.position, Quaternion.identity, transform); } } ` But because I am not an expert I can not figure out who to do that. So I would be glad I someone could help me with this problem

Viewing all articles
Browse latest Browse all 536

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>