Add OBJ mesh support to Unity plugin

This commit is contained in:
Balint-H
2025-01-21 15:11:27 +00:00
parent 36cbef50b7
commit a58f8d0033
4 changed files with 96 additions and 76 deletions
@@ -41,19 +41,19 @@ public class MjMeshFilter : MonoBehaviour {
return;
}
_shapeChangeStamp = currentChangeStamp;
Tuple<Vector3[], int[]> meshData = _geom.BuildMesh();
if (meshData == null) {
throw new ArgumentException("Unsupported geom shape detected");
}
if(_geom.ShapeType == MjShapeComponent.ShapeTypes.Mesh) {
MjMeshShape meshShape = _geom.Shape as MjMeshShape;
_meshFilter.sharedMesh = meshShape.Mesh;
return;
}
_shapeChangeStamp = currentChangeStamp;
Tuple<Vector3[], int[]> meshData = _geom.BuildMesh();
if (meshData == null)
{
throw new ArgumentException("Unsupported geom shape detected");
}
DisposeCurrentMesh();
var mesh = new Mesh();