Three.js使Object3D Child face Camera

时间:2016-01-27 00:52:41

标签: three.js

我有一个旋转的Object3D并且有一个平面作为孩子,我怎样才能使飞机始终面向相机?

select
  case
    when regexp_substr(DateStr,'^[[:digit:]]{1,2}-[[:digit:]]{1,2}-[[:digit:]]{4}$') is not null
    then case
      when to_number(regexp_substr(DateStr,'[^-]+',1,1))<=12
      then case
        when to_number(regexp_substr(DateStr,'[^-]+',1,2)) <= extract(day from last_day(add_months(to_date('01-01-1900','MM-DD-YYYY'),(to_number(regexp_substr(DateStr,'[^-]+',1,3))-1900)*12+to_number(regexp_substr(DateStr,'[^-]+',1,1))-1)))
        then to_date(DateStr,'MM-DD-YYYY')
        else null
        end
      else null
      end
    else null
    end InstallDate
from MyTable

1 个答案:

答案 0 :(得分:5)

使用zz85

中添加this lookAtWorld
THREE.Object3D.prototype.lookAtWorld = function( vector ) {

  this.parent.worldToLocal( vector );
  this.lookAt( vector );

}

或者只是将其破解为:

function animate() {
    /* ... */
    var vector = plane.parent.worldToLocal( camera.getWorldPosition() );
    plane.lookAt( vector );
}

实施例: http://jsfiddle.net/L0rdzbej/201/