Adding a Model

3D models can be easily added to Google Earth by simply calling the GE_AddModel() function and specifying the URL to a COLLADA (.dae) file and the location of where to place it. The specified URL will be used as the main working path, so any additional resource needed by the model (images files, folders) should be located in the same place as the .DAE file.

// add 3D model of palm tree to the beach
GE_AddModel("PalmOnTheBeach",
            25.76566944,
            -80.13073611,
            0.0,
            0.0);

// Set altitude mode to clampToGround
GE_SetModelAltMode("PalmOnTheBeach",
                   ALTMODE_CLAMP_TO_GROUND);

The above code creates the 3D model (of a palm tree) and places it near the ocean in Miami Beach, Florida. The altitude mode was also set to ALTMODE_CLAMP_TO_GROUND so that the model's altitude would be at the ground level, regardless of the terrain elevation. The following picture below shows the result of the above code snippet.

model_palm.png

For additional model functions refer to the Module section on Models.

<< Back to Code Samples


Generated on Wed Sep 16 23:50:34 2009 for Google Earth SDK by  doxygen 1.6.1