Showing the changes to examples/example/scripts/rayPickExample.js (1 of 3 files). Show all
Unified · Split
| @@ -18,20 +18,22 @@ function mouseMoveEvent(event) { · 17 unmodified lines | ||
| 18 | 18 | print("computePickRay origin=" + pickRay.origin.x + ", " + pickRay.origin.y + ", " + pickRay.origin.z); |
| 19 | 19 | print("computePickRay direction=" + pickRay.direction.x + ", " + pickRay.direction.y + ", " + pickRay.direction.z); |
| 20 | 20 | var pickRay = Camera.computePickRay(event.x, event.y); |
| 21 | − intersection = Entities.findRayIntersection(pickRay); | |
| 21 | + intersection = Entities.findRayIntersection(pickRay, true); // to get precise picking | |
| 22 | 22 | if (!intersection.accurate) { |
| 23 | 23 | print(">>> NOTE: intersection not accurate. will try calling Entities.findRayIntersectionBlocking()"); |
| 24 | − intersection = Entities.findRayIntersectionBlocking(pickRay); | |
| 24 | + intersection = Entities.findRayIntersectionBlocking(pickRay, true); // to get precise picking | |
| 25 | 25 | print(">>> AFTER BLOCKING CALL intersection.accurate=" + intersection.accurate); |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | if (intersection.intersects) { |
| 29 | − print("intersection entityID.id=" + intersection.entityID.id); | |
| 29 | + print("intersection entityID=" + intersection.entityID); | |
| 30 | 30 | print("intersection properties.modelURL=" + intersection.properties.modelURL); |
| 31 | 31 | print("intersection face=" + intersection.face); |
| 32 | 32 | print("intersection distance=" + intersection.distance); |
| 33 | − print("intersection intersection.x/y/z=" + intersection.intersection.x + ", " | |
| 33 | + print("intersection intersection.x/y/z=" + intersection.intersection.x + ", " | |
| 34 | 34 | + intersection.intersection.y + ", " + intersection.intersection.z); |
| 35 | + print("intersection surfaceNormal.x/y/z=" + intersection.surfaceNormal.x + ", " | |
| 36 | + + intersection.surfaceNormal.y + ", " + intersection.surfaceNormal.z); | |
| 35 | 37 | } |
| 36 | 38 | } |
| 37 | 39 | |