[Solved] Instantiated objects spawn at diferrent x

I’m building a simple game similar to Wolfenstein 3D. When I instantiate objects (bullets to specify) it has a right rotation, a right y and z positions but x is a little mystery to me. Sometimes it spawns in right x position, sometimes it offset in left or right but always this distance is the same. I’m confused what can be done wrong here. Below you can see code and information about GameObects etc.

public GameObject bullet;
public GameObject bulletSpawnPoint;

protected virtual void Shoot()
        if (canShoot == true)
            if (timerShoot <= 0)
                Instantiate(bullet, bulletSpawnPoint.transform.position, bulletSpawnPoint.transform.rotation);
                timerShoot = fireRate;


So as you can see it takes a position from bulletSpawnPoint and this bulletSpawnPoint is firePoint from this prefab. When I test it, it looks like fire point is always in a right position. I thought it can be something with the position of this fire point because it has positions like from the second screen but even when all coordinates are set to 0 this problem occurs.

If you have any idea what can cause the problem let me know because I’m clueless.

P.S. Hope my English is at least half decent.


Now it works fine. I just locked xyz posiotions in rigidbody component in my Player prefab. The rotation was already locked because it was shaking for some reason but freezing position doesn’t change movement in my case and fix this problem.