GMS 2 Need help with 3D camera


So I recently switched my camera over to using some 3D things so I could create better effects, mostly a tilt when the player is moving but for a few other things.

This is the main chunk of my camera code:
var currentPosX, currentPosY, currentPosZ, viewX, viewY, viewMatrix, projectionMatrix;

currentPosZ = -300;

//get the current camera position for lerping
currentPosX = camera_get_view_x(cameraToChange);
currentPosY = camera_get_view_y(cameraToChange);

//get the camera width and height, this is so the target is always centered
viewX = camera_get_view_width(cameraToChange);
viewY = camera_get_view_height(cameraToChange);

//base camera movement and 3d setup
if(instance_exists(cameraTarget) && followTargetToggle = true){
    //3d things
    projectionMatrix = matrix_build_projection_perspective_fov(cameraFov,cameraAspectRatio,cameraZNear,cameraZFar);  
    viewMatrix = matrix_build_lookat(currentPosX,currentPosY,currentPosZ,cameraTarget.x,cameraTarget.y,0,0,1,0);
    //lerp the camera to the target position  
    goalX = lerp(currentPosX,cameraTarget.x - viewX/2,cameraSpd);
    goalY = lerp(currentPosY,cameraTarget.y - viewY/2,cameraSpd);
    //apply the lerped variables to the camera position
    camera_set_view_pos(cameraToChange,goalX - screenShakeX,goalY - screenShakeY);
with the 3D parts being set underneath with a simple camera_set_view and proj. This works fine and sets the camera to be 3D, aside from one issue, in that it looks like this.
The camera instead needs to be directly above the ship, following it around with a slight rotation tilt as the camera lerps. Does anyone know what I could be doing wrong? 3D stuff is a bit beyond me.
Last edited: