hello I have an enemy that instantiates bullets with a rate, and on the bullet I have this script Code (Csharp): void Start() { bee = Gameobject.Find(“bee”); rb.velocity = (bee.transform.position - transform.position).Normalized * speed; } But when the bullet appears it just stays static and doesn’t move am I doin something wrong? Thanks in advance
So you need to have the : Code (CSharp): rb.velocity = (bee.transform.position - transform.position).Normalized * speed; Inside of an Update method. At the moment you only have it targeting the bee and only at the very start of instantiation moving towards the target.
Oh my mistake I thought you wanted to track it like a missile. I'd take out the Normalized part of your code and increase the speed to something like 5 and it should shoot towards your bee target. Code (CSharp): public GameObject bee; public int speed = 3; Rigidbody rb; void Start(){ rb = this.GetComponent<Rigidbody>(); bee = GameObject.Find("bee"); rb.velocity = (bee.transform.position-transform.position) * speed; }