I’m brand new to all this learning between youtube & unity documentation, so I’ve only the most basic understanding.
I’m making a tiny side scrolling spaceship shooter. My problem is that the bullet prefab spawns in the correct place on the firepoint(empty object parented to player) and begins to move forward fine but it then follows the player up and down(on the x) as it moves, including the players rotation. It should just move forward (along the y axis) and nothing on the x. Anyone see what I’m doing wrong?
//on my player script
private void Update()
{
if (Input.GetKeyDown(KeyCode.Space))
{
Shoot();
}
}
void Shoot()
{
Instantiate(energyBallPrefab, firePoint);
}
//on bullet prefab script
{
public float bulletSpeed = 20f;
public Rigidbody2D rbBullet;
private void Start()
{
rbBullet.velocity = new Vector2(0, 1 * bulletSpeed);
}`