How to Access Meshes in AIRSIM#

AirSim supports the ability to access the static meshes that make up the scene

Mesh structure#

Each mesh is represented with the below struct.

struct MeshPositionVertexBuffersResponse {

    Vector3r position;
    Quaternionr orientation;

    std::vector<float> vertices;
    std::vector<uint32_t> indices;
    std::string name;
* The position and orientation are in the Unreal coordinate system. * The mesh itself is a triangular mesh represented by the vertices and the indices. * The triangular mesh type is typically called a Face-Vertex Mesh. This means every triplet of indices hold the indexes of the vertices that make up the triangle/face. * The x,y,z coordinates of the vertices are all stored in a single vector. This means the vertices vertices is Nx3 where N is number of vertices. * The position of the vertices are the global positions in the Unreal coordinate system. This means they have already been Transformed by the position and orientation. *

How to use#

The API to get the meshes in the scene is quite simple. However, one should note that the function call is very expensive and should very rarely be called. In general this is ok because this function only accesses the static meshes which for most applications are not changing during the duration of your program.

Note that you will have to use a 3rdparty library or your own custom code to actually interact with the recieved meshes. Below I utilize the python bindings of libigl to visualize the recieved meshes.

import airsim


client = airsim.VehicleClient(ip=AIRSIM_HOST_IP)

# List of returned meshes are received via this function

for m in meshes:
    # Finds one of the cube meshes in the Blocks environment
    if 'cube' in

        # Code from here on relies on libigl. Libigl uses pybind11 to wrap C++ code. So here the built
        # library is in the same directory as this example code.
        # This is here as code for your own mesh library should require something similar
        from pyigl import *
        from iglhelpers import *

        # Convert the lists to numpy arrays


        # Libigl requires the shape to be Nx3 where N is number of vertices or indices
        # It also requires the actual type to be double(float64) for vertices and int64 for the triangles/indices

        #Libigl function to convert to internal Eigen format

        # View the mesh
        viewer = igl.glfw.Viewer(),i_eig)