Version: 2023.2

XRMeshSubsystem.GenerateMeshAsync

切换到手册
public void GenerateMeshAsync (XR.MeshId meshId, Mesh mesh, MeshCollider meshCollider, XR.MeshVertexAttributes attributes, Action<MeshGenerationResult> onMeshGenerationComplete);

参数

meshId 要生成的网格的 MeshId
mesh 要将结果写入的 Mesh
meshCollider (可选)要填充物理数据的 MeshCollider。此参数可为 null。
attributes 希望使用的顶点属性。
onMeshGenerationComplete 生成完成时调用的委托。

描述

请求生成具有 MeshId meshId 的网格。生成完成时,Unity 会调用 /onMeshGenerationComplete/。

Use this method to request that a mesh is asynchronously generated. "Generation" includes extracting the mesh data from the subsystem's mesh provider (e.g., an AR device) and baking the MeshCollider (if meshCollider is not null).

This happens in a background thread. For large meshes, this can take several frames to complete. onMeshGenerationComplete is invoked when the generation completes.

The mesh vertices are provided in session space.

See Also: XRMeshSubsystem.TryGetMeshInfos


public void GenerateMeshAsync (XR.MeshId meshId, Mesh mesh, MeshCollider meshCollider, XR.MeshVertexAttributes attributes, Action<MeshGenerationResult> onMeshGenerationComplete, XR.MeshGenerationOptions options);

参数

meshId 要生成的网格的 MeshId
mesh 要将结果写入的 Mesh
meshCollider (可选)要填充物理数据的 MeshCollider。此参数可为 null。
attributes 希望使用的顶点属性。
onMeshGenerationComplete 生成完成时调用的委托。
options The mesh generation options.

描述

请求生成具有 MeshId meshId 的网格。生成完成时,Unity 会调用 /onMeshGenerationComplete/。

This variant allows you to specify additional mesh generation options.

Note: If the MeshGenerationOptions.ConsumeTransform flag is set in the options argument, the resulting mesh will be relative to the transform provided by the MeshGenerationResult. If this flag is not set, the vertices are transformed into session space and the MeshGenerationResult will contain an identity transform.

See Also: XRMeshSubsystem.TryGetMeshInfos

Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961