在三个 js 中添加摄像头

Get added camera in three js

我有一个对象 caradd 相机。我现在如何通过这个对象访问相机。我试过这个:

car = {};
car.body = new Physijs.BoxMesh(
    new THREE.BoxGeometry( 10, 5, 7 ),
    Physijs.createMaterial(
        new THREE.MeshLambertMaterial({ color: color }), .8, .2 ), 
    1000 );
var camera = new THREE.PerspectiveCamera(50, window.innerWidth/window.innerHeight, 1, 1000);
var pos = car.body.position;
camera.position.set(pos.x + 75, pos.y + 20, pos.z);
camera.lookAt( pos );
car.body.add(camera);

//...

// other function

var camera = car.body.camera;

但我收到一条错误消息 THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.

这有可能吗,还是我必须将相机保存在某个全局变量(数组)中?

要在 car.body 中引用相机。
使用:

car.body.camera = camera;

而不是:

car.body.add(camera);