admin管理员组文章数量:1415099
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.
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.
Share Improve this question edited Sep 23, 2015 at 2:06 WestLangley 105k11 gold badges287 silver badges283 bronze badges asked Sep 23, 2015 at 1:46 keearixkeearix 331 silver badge4 bronze badges1 Answer
Reset to default 7When 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
本文标签: javascriptThreejs ray cast get coordinate of intersectionStack Overflow
版权声明:本文标题:javascript - Threejs ray cast get coordinate of intersection - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745188595a2646801.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论