Merge pull request #2378 from Balint-H:feature/unity-obj
PiperOrigin-RevId: 772619174 Change-Id: I62a2bbeb0d8bb0fb007af1abc93d6e8b3449b3fe
This commit is contained in:
@@ -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) {
|
||||
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();
|
||||
@@ -67,7 +67,6 @@ public class MjMeshFilter : MonoBehaviour {
|
||||
uvs[i] = new Vector2(mesh.vertices[i].x, mesh.vertices[i].z);
|
||||
}
|
||||
mesh.uv = uvs;
|
||||
|
||||
mesh.RecalculateNormals();
|
||||
mesh.RecalculateTangents();
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ public class MjMeshShape : IMjShape {
|
||||
var assetName = MjEngineTool.Sanitize(
|
||||
mjcf.GetStringAttribute("mesh", defaultValue: string.Empty));
|
||||
if (!string.IsNullOrEmpty(assetName)) {
|
||||
Mesh = (Mesh)Resources.Load(assetName);
|
||||
Mesh = Resources.Load<Mesh>(assetName);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user