I’m trying to make a top down shooter and right now I’m getting the player to shoot. Basically I’m using the same line of code to move the projectile as I use to move the player, but it does not work.
This is the code:
void FixedUpdate()
{
this.GetComponent<Rigidbody2D>().AddForce(gameObject.transform.up * projectileSpeed);
}
This projectileSpeed is set to more than zero and I’ve tested it with a fixed float value, still nothing. It just gets instantiated and stands still. Any idea of what’s going on or what am I doing wrong? Thanks!