Quantcast
Channel: Babylon.js
Viewing all articles
Browse latest Browse all 388

I do something wrong with mesh.intersectsPoint(otherMesh.position)...

$
0
0

Hi guys,

 

I'm creating a simple selection-mechanism with a 'rubberband' which selects all the meshes within that rubberband.

What I have now is this:

 

http://www.babylonjs-playground.com/#4EPTA

 

For selection, I check the intersection of the generated rubberband mesh (line 122) with the existing box positions and if they intersect, the selected boxes get a green color. Like this:

 

        function getMeshesSelectedByRubberBand() {
             var meshes = [];
             for (var index in boxes) {
                 var box = boxes[index];
                 if (game.rubberBand.intersectsPoint(box.position)) {
                     meshes.push(box);
                 }
             }
             return meshes;
         }
 
but as you can see the wrong boxes are selected, and I don't understand why... Do anybody see anything wrong?

Viewing all articles
Browse latest Browse all 388

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>