I am working with the Godot Game Engine, and I have an ImmediateGeometry node which is drawing a mesh I am generating at runtime, but it is Z-fighting with another mesh. How can I move the ImmediateGeometry vertices closer to the 3D Camera as to not clip into the other mesh?
To move the vertices of an ImmediateGeometry closer to the camera, you can simply modify the position of the vertices in code. One way to do this is to translate the vertex positions along the camera's view vector.

Assuming you have a reference to your camera node, you can get the camera's global transform and use it to calculate the camera's view vector. You can then use this vector to move the vertex positions towards the camera.

Here is some example code to accomplish this:

    # Get a reference to the camera node
    var camera = get_node(Camera)

    # Get the global transform of the camera
    var camera_transform = camera.global_transform

    # Get the camera's view vector
    var view_vector = -camera_transform.basis.z

        # Loop through each vertex of the ImmediateGeometry
        for i in range(immediate_geometry.get_vertex_count()):
            # Get the current vertex position
            var vertex_position = immediate_geometry.get_vertex(i)

            # Move the vertex position towards the camera
            vertex_position += view_vector

            # Set the new vertex position
            immediate_geometry.set_vertex(i, vertex_position)

This code assumes that the ImmediateGeometry node is a child of the node that this code is running on. If the ImmediateGeometry node is not a child, you will need to use the appropriate method to get a reference to it.

Note that moving the vertices towards the camera may cause other clipping issues, so you may need to experiment with the amount you move the vertices to find a value that works for your specific use case.