想移植一下ThreeJS的RaycstTexture,需要一个模型的顶点,索引,UV坐标信息,请问一下,这些信息有没有什么接口可以获取的。
http://www.yanhuangxueyuan.com/threejs/examples/?q=raycast#webgl_raycast_texture
查看meshRender组件
请问可以详细说一下吗,或者给个示例。
试试renderingSubMeshes
const model = this.model.getComponent(MeshRenderer);
if (model && model.mesh && model.mesh.renderingSubMeshes.length > 0) {
let normals = [];
const positions=model.mesh.renderingSubMeshes[0].geometricInfo.positions.slice()
const indices=model.mesh.renderingSubMeshes[0].geometricInfo.indices!.slice()
for(var i=0;i<indices.length;i++){
normals.push(0);
normals.push(1);
normals.push(0);
}
const geo = {
normals:normals,
positions: positions,
indices: indices,
}
const mesh = utils.createMesh(primitives.wireframed(geo as any));
}
1赞
非常感谢,请问一下,UV坐标的信息怎么获取?
UV 坐标在模型的材质中获取,你会看到 uv 相关的属性。