jeudi 11 février 2021

Three.js random position from mesh coordonates

I'm really new to three.js,

I would like to give a simple mesh a random position from another mesh coordinates. Just like that :

example

I want to little yellow box to randomly positionate above the M letter.emphasized text

I tried this

var points = THREE.GeometryUtils.randomPointsInGeometry( geometry, nPoints );
        const cube2 = new THREE.Mesh(cube, jaune);
        cube2.position.set(1, 0, 0);
        scene.add(cube2);

but it doesn't seems to work. Sorry in advance if it's too obvious ;)




Aucun commentaire:

Enregistrer un commentaire