提交 41126648 编写于 作者: W WestLangley

Sprite: Fix raycast bug

Raycasting with sprites is an approximation in that the sprite is treated as a disk. In addition, sprites can be non-square, and can be rotated.

With this change, if the sprite is square, the "clickable" region is inside the inscribed circle. If the sprite is non-square, the approximation is not very good, but it is better than before.
上级 1993bc92
......@@ -39,7 +39,7 @@ THREE.Sprite.prototype.raycast = ( function () {
matrixPosition.setFromMatrixPosition( this.matrixWorld );
var distanceSq = raycaster.ray.distanceSqToPoint( matrixPosition );
var guessSizeSq = this.scale.x * this.scale.y;
var guessSizeSq = this.scale.x * this.scale.y / 4;
if ( distanceSq > guessSizeSq ) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册