THREE.js - position particles evenly on objects faces rather than verticies

后端 未结 2 1495
野趣味
野趣味 2021-01-06 09:20

Currently I\'ve managed to create a particleCloud with the particles appearing at each vertex of an object I\'ve imported. However I\'m trying to get the particles to firstl

2条回答
  •  悲哀的现实
    2021-01-06 09:51

    three.js has some handy methods you can use:

    THREE.GeometryUtils.randomPointsInGeometry( geometry, n )
    
    THREE.GeometryUtils.randomPointsInBufferGeometry( geometry, n )
    
    THREE.GeometryUtils.randomPointInFace( face, geometry )
    

    The result may look better if THREE.GeometryUtils.randomPointsInGeometry() ( or BufferGeometry ) is used, as it samples according to face area.

    The required GeometryUtils.js file is located in the examples/js/utils directory.

    three.js r.71

提交回复
热议问题