So, I have a plane, and I got raycast set up. What I want to do is get the coordinate of the intersection on the plane, thanks.
(Note: the color change is just to test if the raycast was actually working.)
Here is my code :
raycaster.setFromCamera( mouse, camera );
//calculate objects intersecting the picking ray
var intersects = raycaster.intersectObjects( scene.children );
for ( var i = 0; i < intersects.length; i++ ) {
intersects[ i ].object.material.color.set( 0xff0000 );
}
Cheers, Keegan.
When using Raycaster
, the value intersects[ i ].point
is a Vector3()
representing the world coordinates of the point of intersection.
Inspect intersects[ i ]
in the console to see what else is returned.
three.js r.72
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.