Stopping bullets from being affected by the shooters speed

Aggggh i just cant remember,

i have only noticed now that my bullet direction is slightly being influenced by the object thats shootings speed.
How can i correct this?

Gonna have to show us your shooting code for us to be able to help you.

1 Like

Usually you have to do something extra to make the player’s speed affect bullets.

The only other thing might be that if you are using physics, your player is physically bumping the bullet from behind, but that usually results in wildly ridiculous bullet deflection / speed change.

2 Likes

sure! heres my laser method:

public void FireLaser()
    {   if (!hyperSpace && isAlive)
        {
            FindObjectOfType<AudioManager>().Play("PlayerLaserRed");
            GameObject newLaserRed = Instantiate(laserRed, weaponSpawnPoint.transform.position, transform.rotation);
            newLaserRed.GetComponent<Rigidbody2D>().AddRelativeForce(Vector2.up * laserRedSpeed);
            Destroy(newLaserRed, 0.8F);
        }
    }

If you are talking about the spawnpoint of the bullet appearing to shift slightly side to side and back and forth upon firing while moving, then the issue might actually be your player move script. I find that oftentimes this issue is actually caused by your player move script, rather than your bullet or gun script. Try using just the straight character controller and the locomotion system for player move, even if only for testing purposes, and then try to move back and forth and run while shooting.

1 Like

I’m wondering if he is seeing player movement happening after the bullet spawn. So the bullet spawns at the position the player was the previous frame.