I am trying to download a obj file or fbx file from a remote server into my game scene dynamically. I want to replace the empty game object with the fbx or obj model. For example I have a fbx file of a 3D house, I want to load this dynamically when a user collides with a specific gameobject… any code ideas?
I am currently familiar with the code below for downloading images and converting to textures but how would I go about downloading a 3D obj or fbx file and displaying that inside my gameobject
// Continuously get the latest webcam shot from outside “Friday’s” in Times Square
// and DXT compress them at runtime
var url = “http://images.earthcam.com/ec_metros/ourcams/fridays.jpg”;
function Start () {
// Create a texture in DXT1 format
renderer.material.mainTexture = new Texture2D(4, 4, TextureFormat.DXT1, false);
while(true) {
// Start a download of the given URL
var www = new WWW(url);
// wait until the download is done
yield www;
// assign the downloaded image to the main texture of the object
www.LoadImageIntoTexture(renderer.material.mainTexture);
}
}