I'm trying to raycast against a line that is created with BufferGeometry
. But it does not seem to support raycasting?
When initiating BufferGeometry
as shown here raycasting does not work on this object.
But when I replace BufferGeometry
with Geometry
raycasting works fine.
var geometry = new THREE.Geometry();
var lines = new THREE.Object3D();
for ( var i = 0; i <array.length; i++) {
x = ( Math.random() - 0.5 ) * 30;
y = ( Math.random() - 0.5 ) * 30;
z = ( Math.random() - 0.5 ) * 30;
geometry.vertices.push(new THREE.Vector3(x,y,z));
}
var line = new THREE.Line( geometry, new THREE.LineBasicMaterial( { color: 0x9999FF, opacity: 0.5 } ) );
lines.add(line);
scene.add(lines);
I've tried to wrap BufferGeometry
to Object3D
also, does not affect the outcome. How to raycast against BufferGeometry
line?
EDIT
BufferGeometry
. My line was too small and I could not hit it with a ray. So the problem is solved, thanks for the comment! – user3960875