article:
tag:
mod code publish @2011-06-28

three.js > 3d 位置转 2d 上一篇 | 下一篇

three, 3d, 2d

function getCoordinates( element, camera ) {

    var screenVector = new THREE.Vector3();
    element.localToWorld( screenVector );

    screenVector.project( camera );

    var posx = Math.round(( screenVector.x + 1 ) * renderer.domElement.offsetWidth / 2 );
    var posy = Math.round(( 1 - screenVector.y ) * renderer.domElement.offsetHeight / 2 );

    console.log( posx, posy );
}
 
http://jsfiddle.net/L0rdzbej/122/
@suches
http://btbtd.com/mods/code/item.php?uid=1&item=4802

发表于 @ 2018-06-06 15:53:05

该文章暂时没有回复
评论内容:
昵称:
验证码: