Problems with first person camera 3D

I have a strange problem that I will try and explain as good as I can.

I have attached the camera to the player, everything works well with walking around, jumping and looking in all directions.

Now I am trying to implement shooting bullets from the gun (the cube is the substitute gun).

Doing this I noticed that the camera doesn’t seem to be directly on the player somehow.

The player should be standing between the two snowmen (which should make the camera also stand there), as the position is set to be there.

This becomes apparent when trying to shoot a bullet (snowmen are substitute bullets). The bullets do not move at all when being shot at the moment and no matter which side the camera is looking at, it always spawns the bullet in that same position (See picture number two for position).

I have a hard time finding out why the camera doesn’t position itself directly on the players position.

Player starts in wrong position:

Player shoots a bullet:

Camera class:

class FirstPersonCamera
{
    private Vector3 position;
    private Vector3 rotation;
    private Vector3 lookAt;
    private Vector3 up = Vector3.Up;
    private Vector3 forward = Vector3.Forward;
    private Vector3 offset = new Vector3(0, 0.45f, 0);

    private Matrix projection;

    private Entity attachedTo;

    public Vector3 Offset { get => offset; }
    public Vector3 LookAt { get => lookAt; }
    public Vector3 Up { get => up; }
    public Vector3 Direction { get => forward; }

    public Vector3 Position
    {
        get { return position; }
        set
        {
            position = value;
            UpdateLookAt();
        }
    }

    public Vector3 Rotation
    {
        get { return rotation; }
        set
        {
            rotation = value;
            UpdateLookAt();
        }
    }

    public Matrix Projection { get => projection; protected set => projection = value; }

    public Matrix View { get => Matrix.CreateLookAt(position, lookAt, up); }

    public Matrix World { get => Matrix.CreateWorld(lookAt, forward, up); }

    public FirstPersonCamera(GraphicsDevice graphicsDevice, Vector3 position, Vector3 rotation)
    {
        projection = Matrix.CreatePerspectiveFieldOfView((float)(Math.PI / 3), graphicsDevice.Viewport.AspectRatio, 0.01f, 1000.0f);

        MoveTo(position, rotation);
    }

    public void Update(GameTime gameTime)
    {
        MoveTo(attachedTo.Position + offset, attachedTo.Rotation);
    }

    public void AttachTo(Entity entity)
    {
        attachedTo = entity;
    }

    private void MoveTo(Vector3 position, Vector3 rotation)
    {
        Position = position;
        Rotation = rotation;
    }

    private void UpdateLookAt()
    {
        Matrix rotationMatrix = Matrix.CreateRotationX(rotation.X) * Matrix.CreateRotationY(rotation.Y) * Matrix.CreateRotationZ(rotation.Z);

        Vector3 lookAtOffset = Vector3.Transform(Vector3.UnitZ, rotationMatrix);

        lookAt = position + lookAtOffset;
    }
}

Is the camera for these screenshots a free-cam or the first person camera? Is the gun supposed to be located on the player’s position (if the position of the player is supposed to be between the 2 snowmen, then the bullet is spawning on the player)? How much of a difference does the offset var make (it also isn’t taking the value of rotation into account)?

I’m just a bit confused by the explanation of your problem. Maybe an mspaint diagram would be a bit more clear, but once I understand I’ll be happy to throw my 2 cents in.

FIXED (Thank you Mateo_Loooong for making me inspect another part of the code!) but the reply I was writing is below:

The camera is a first person camera that works as it should when it comes to moving the mouse, walking with WASD and jumping.

The gun somehow actually sticks to the right place in front of the camera.

The offset var only makes the camera go a little bit up, as it would be very close to the floor otherwise. Not sure if it needs to take the rotation into account.

I’ll try to explain a bit better:
Leftmost snowman is on position Vector3(5f, 1f, 5f)
Rightmost snowman is on position Vector3(15f, 1f, 5f)

Player position (which also makes camera position on the same spot except for 0.45f higher on Y-axis) is on Vector3(10f, 1f, 5f), and this should be between the two snowmen but somehow the camera doesn’t view from there.

So the issue here is that the camera view isn’t in the same position as the cameras position.

Testing around now before replying I somehow got it to work as expected…
Seems like having the animated snowman being the model of bullets was the culprit. That is some strange behaviour, no idea why it would change where the camera should view from.