             gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT)
             mat4.copy(world2cam, @context.render_manager._world2cam)
             mat4.copy(world2cam_mx, @context.render_manager._world2cam_mx)
-            vec3.copy(@cam_pos, camera.position)
-            quat.copy(@cam_rot, camera.rotation)
+            mat4.copy(@cam2world, camera.world_matrix)
             # Assuming perspective projection and no shifting
             @inv_proj_x = camera.projection_matrix_inv[0]
             @inv_proj_y = camera.projection_matrix_inv[5]

            # console.log((performance.now() - t).toFixed(2) + ' ms')
            @step = 0
            @rounds += 1
            vec3.copy(@last_cam_pos, @cam_pos)
            quat.copy(@last_cam_rot, @cam_rot)
            @draw_debug_canvas()
        return


        point[0] = xf*depth
        point[1] = yf*depth
        point[2] = -depth
        vec3.transformMat4(point, point, @last_cam2world)
        # we do this instead of just passing depth to use the current camera position
        # TODO: move this out of this function to perform it only when it's used?
        distance = vec3.distance(point, cam.world_matrix.subarray(12,15))
        # I don't know why does this happen
        if isNaN distance
            return null
        return {object, point, distance}

    do_step: ->
        gl = @context.render_manager.gl
