KITASENJU DESIGN BLOG

memo, html, javascript, unity

雑orbit camera

import * as THREE from 'three';

export class ExCamera{

    public oCamera:THREE.OrthographicCamera;
    public pCamera:THREE.PerspectiveCamera;
    public target:THREE.Vector3 = new THREE.Vector3(0,0,0);
    
    public amp:number = 1500;
    public radX:number = 0;
    public radY:number = 0;

    constructor(cam:THREE.OrthographicCamera){
      
        this.oCamera = cam;

    }

    update(){

        var xx = this.amp * Math.sin( this.radX) * Math.cos(this.radY);
        var yy = this.amp * Math.sin( this.radY);
        var zz = this.amp * Math.cos( this.radX ) * Math.cos(this.radY);

        this.oCamera.position.x = xx;//
        this.oCamera.position.y = yy;//
        this.oCamera.position.z = zz;//
        
        this.oCamera.lookAt(this.target);

    }

}
"FOOTER"