Babylonjs学习笔记(十)——拉伸多边形

2023-12-13 14:28:30

pnpm i earcut? ?@types/earcut --save-d

import earcut from "earcut";

  const outline = [new Vector3(-0.3, 0, -0.1), new Vector3(0.2, 0, -0.1)];

  for (let i = 0; i < 20; i++) {
    outline.push(new Vector3(0.2 * Math.cos((i * Math.PI) / 40), 0, 0.2 * Math.sin((i * Math.PI) / 40) - 0.1));
  }

  outline.push(new Vector3(0, 0, 0.1));
  outline.push(new Vector3(-0.3, 0, 0.1));

  const car = MeshBuilder.ExtrudePolygon("car", { shape: outline, depth: 0.2 }, scene, earcut);

文章来源:https://blog.csdn.net/weixin_41718879/article/details/134970718
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。