I'm trying to get a distance to intersection of a mesh. The mesh is a imported json loaded with ObjectLoader.
trnek.set(pozTravcex,0,pozTravcez);
sidro.set(pozTravcex,100,pozTravcez);
sidro.normalize();
plovc.set(trnek,sidro);
scene.updateMatrixWorld();
visinaTravce = plovc.intersectObjects(scene.children,true);
var point=0;
for (var j=0; j < visinaTravce.length; j++){
if (visinaTravce[j].object.name == "tla"){
pozTravcey = visinaTravce[j].distance; //plovc.ray.origin.distanceTo(visinaTravce[0].point);
point = visinaTravce[j].point;
console.log("razdalja je: ",visinaTravce[j].point.y);
- I got it working, if I shrink the mesh before I export it. ( so I operate with coordinates <2.0.
- Scaling the mesh gives issues to raycaster ( I updated the scenes matrixWorld. )
So bottom line is. I get the right y distance if the object is super small. If I resize and export it, then the measured distance gets messed up the farther away from center it goes.
http://s000.tinyupload.com/?file_id=51927245638674467144
on the left side the picture grass is near 0,0,0, the distance measured ( y ) is right. Farther away the distance gets wrong. If I shrink the object, everything is in place.
is this a bug perhaps?