Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have multiple meshes, and want to add a point in a random part contained within hexagon[0]. how can I do it?

var Hexagon=new Array();
Hexagon[0] = new THREE.Mesh( HexagonExtrude[0],material[0] );
Hexagon[1] = new THREE.Mesh( HexagonExtrude[1],material[1]  );
Hexagon[2] = new THREE.Mesh( HexagonExtrude[2],material[2]  );
Hexagon[3] = new THREE.Mesh( HexagonExtrude[3],material[3]  );
Hexagon[4] = new THREE.Mesh( HexagonExtrude[4],material[4]  );
Hexagon[5] = new THREE.Mesh( HexagonExtrude[5],material[5]  );
Hexagon[6] = new THREE.Mesh( HexagonExtrude[6],material[6]  );

http://jsfiddle.net/fznore2c/

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
232 views
Welcome To Ask or Share your Answers For Others

1 Answer

If the mesh is of unknown shape (is it even closed?) then you either have to do something fancy like use signed distance fields, voxelization, or pick a point based on the bounding box as @gaitat has suggested. The reason samples use boxes and spheres is because those shapes have very well-behaved, simple-arithmetic properties. If you want to do fancier things like pick random points inside a random shape, well... that's much tougher!

Another approach you might consider is having invisible particle emitter zones that are part of your object. Your object might be shaped, say, like a monster in a game, but the particles inside it only come from a few spherical regions within the complex, deforming mesh. Not directly from the mesh itself.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...