当前Graphics.DrawMesh具有以下构造函数:
public static void DrawMesh(Mesh mesh, Vector3 position, Quaternion rotation);
public static void DrawMesh(Mesh mesh, Vector3 position, Quaternion rotation, int materialIndex);
public static void DrawMesh(Mesh mesh, Vector3 position, Quaternion rotation, Material material, int layer, Camera camera = null, int submeshIndex = 0, MaterialPropertyBlock properties = null, bool castShadows = true, bool receiveShadows = true);
public static void DrawMesh(Mesh mesh, Vector3 position, Quaternion rotation, Material material, int layer, Camera camera, int submeshIndex, MaterialPropertyBlock properties, Rendering.ShadowCastingMode castShadows, bool receiveShadows = true, Transform probeAnchor = null);
public static void DrawMesh(Mesh mesh, Matrix4x4 matrix);
public static void DrawMesh(Mesh mesh, Matrix4x4 matrix, int materialIndex);
public static void DrawMesh(Mesh mesh, Matrix4x4 matrix, Material material, int layer, Camera camera = null, int submeshIndex = 0, MaterialPropertyBlock properties = null, bool castShadows = true, bool receiveShadows = true);
public static void DrawMesh(Mesh mesh, Matrix4x4 matrix, Material material, int layer, Camera camera, int submeshIndex, MaterialPropertyBlock properties, Rendering.ShadowCastingMode castShadows, bool receiveShadows = true, Transform probeAnchor = null);
Run Code Online (Sandbox Code Playgroud)
而位置和旋转被暴露,没有过载的接受比例参数来设置刻度动态拉伸网状的。
小智 5
您可以使用Matrix4x4.TRS函数创建一个结合位置,旋转和比例的矩阵,然后可以在Graphics.DrawMesh中使用它。例如:
Vector3 position = Random.insideUnitSphere;
Quaternion rotation = Random.rotation;
Vector3 scale = new Vector3(0.5f, 1, 2.5f);
Matrix4x4 matrix = Matrix4x4.TRS(position, rotation, scale);
Graphics.DrawMesh(mesh, matrix, material, 0);
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
3602 次 |
最近记录: |