Hello, I am making a game of ships and I place a meteorite but when I execute it it goes to the side or up and I need the meteorite to go down towards my main character, this is my code.
{
public float Velocidad = 6;
Rigidbody rb;
// Start is called before the first frame update
void Start()
{
rb = GetComponent<Rigidbody> ();
rb.velocity = Vector3.back * Velocidad + Vector3.right * Random.Range(-1, 1);
rb.angularVelocity = new Vector3 (Random.Range(-5, 5), Random.Range(-5, 5), Random.Range(-5, 5));
}
You have to check the position of the player every frame, that's why it only checks it once at the start (void Start()) and then goes straight to that place.
Whatever you use, I recommend that it be the method that checks every time a frame is updated so that it is not a jet instead of a meteor hahaha