I attempted to get properties in metadata without raycast ,but failed,code is below.I think maybe i make a mistake when getting vertex/triangle index,but i dont know how to do it right.
var tilesets = model.gameObject.GetComponent();
var metadatas = tilesets.GetComponentsInChildren();
if (metadatas != null)
{
foreach (var metadata in metadatas)
{
var feature = metadata.GetComponentsInChildren();
foreach (var fea in feature)
{
var meshfilter = fea.GetComponent();
var index = (int)meshfilter.mesh.GetIndexStart(0);
var featureid = fea.GetFeatureIdFromTriangle(index);
var table = metadata.propertyTables;
var pros = table[fea.featureIdSets[0].propertyTableIndex];
var dic = pros.GetMetadataValuesForFeature(featureid);
foreach (var d in dic)
{
Debug.Log(d.Key);
string f = "null";
d.Value.GetString(f);
Debug.Log(f);
}
}
}
}
also, I want to know is someway to get extras (in ExtensibleObject.h cesium-unity-native).I consider whether I can get extras in ceisum metadata or other methods?cause MeshPrimitive extends ExtensibleObject.