/* * attempts to load and returns all loaded UDS models in the scene */ public static udRenderInstance[] getUDSInstances() { GameObject[] objects = GameObject.FindGameObjectsWithTag("UDSModel"); int count = 0; udRenderInstance[] modelArray = new udRenderInstance[objects.Length]; for (int i = 0; i < objects.Length; ++i) { UDSModel model = (UDSModel)objects[i].GetComponent("UDSModel"); if (!model.isLoaded) { model.LoadModel(); } if (model.isLoaded) { modelArray[count].pointCloud = model.udModel.pModel; Transform localTransform = objects[i].transform; modelArray[count].worldMatrix = UDUtilities.GetUDMatrix( Matrix4x4.TRS(model.transform.position, model.transform.rotation, model.transform.localScale) * model.modelToPivot ); count++; } } return(modelArray.Where(m => (m.pointCloud != System.IntPtr.Zero)).ToArray()); }
/* * attempts to load and returns all loaded UDS models in the scene */ public static vdkRenderInstance[] getUDSInstances() { GameObject[] objects = GameObject.FindGameObjectsWithTag("UDSModel"); int count = 0; vdkRenderInstance[] modelArray = new vdkRenderInstance[objects.Length]; for (int i = 0; i < objects.Length; ++i) { Component component = objects[i].GetComponent("UDSModel"); UDSModel model = component as UDSModel; if (!model.isLoaded) { model.LoadModel(); } if (model.isLoaded) { modelArray[count].pointCloud = model.udModel.pModel; modelArray[count].worldMatrix = UDUtilities.GetUDMatrix(model.pivotTranslation * model.modelScale * objects[i].transform.localToWorldMatrix * model.pivotTranslation.inverse); count++; } } return(modelArray.Where(m => (m.pointCloud != System.IntPtr.Zero)).ToArray()); }