In need of help with generating a large number of draggable objects that are limited to a plane form such as rectangles or circles. Initially, I used simple CircleGeometries placed inside another geometry (plane) for easy dragging, but performance suffered greatly with around 200000 objects. I then switched to points/particleSystem, which worked well for positioning within the plane, but I struggled to make individual points draggable. I tried incorporating dragcontrols from the Three.js documentation's interactive particles example, but I'm still unsure how to integrate them.
//Creating a plane geometry to be filled with points
var geometry2 = new THREE.CircleGeometry(30,32);
var material2 = new THREE.MeshBasicMaterial( {color: 0x666666, side: THREE.DoubleSide, wireframe:true} );
var mat1 = new THREE.MeshBasicMaterial( {color: 0x00ff00, wireframe:false} );
var plane1 = new THREE.Mesh(geometry2, material2);
geometries.push(plane1); //add to object for draggable elements
scene.add(plane1);
var positionsX;
positionsX = inGeometry.inGeometry(plane1.geometry, 200000); // get positions for points inside plane1
var geometry = new THREE.Geometry();
for (var i = 0; i < positionsX.length; i++) {
geometry.vertices.push(positionsX[i]); //adding positions to vertices
}
//Create Particle system
var material = new THREE.PointsMaterial({ size:0.02, color: 0xffffff });
particleSystem = new THREE.Points(geometry, material);
scene.add(particleSystem);
var dragGeo = new DragControls(geometries, camera, container); //enable dragging
Any assistance would be greatly appreciated! Thank you.