Converting SVG paths with holes to extruded shapes in three.js

流过昼夜 提交于 2019-12-05 11:06:00

You can't have a moveTo in the middle of a shape definition. You have to have two separate shapes. You can do something like this:

var object = new THREE.Object3D();

var shape1 = new THREE.Shape();
var shape2 = new THREE.Shape();

var hole1 = new THREE.Path();
var hole2 = new THREE.Path();

shape1.holes.push( hole1 );
shape2.holes.push( hole2 );

. . .

object.add( mesh1 );
object.add( mesh2 );

scene.add( object );

Fiddle: http://jsfiddle.net/pHn2B/34/

three.js r.58

P.S. Friendly tip: In the future, it would be a good idea to make it easy for people to help you -- edit your variable names and remove unrelated code from your example.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!