I am to trying get this Script to start shooting when the Player’s Velocity is above 0. I have tested it but when the player is stationary it’s still shooting projectiles.
public Rigidbody Bullet;
public Rigidbody PlayerRigidbody;
// Use this for initialization
void Start () {
PlayerRigidbody = GameObject.Find("Player").GetComponent<Rigidbody>();
}
// Update is called once per frame
void Update ()
{
if(PlayerRigidbody.velocity.magnitude < 0)
{
Instantiate(Bullet,transform.position,transform.rotation);
transform.TransformDirection(Vector3.down * 10);
}
{
}
}
}