Hi, I have a question about camera position and rotation around on object.
I want to draw top, front, side view of object(3d bounding box).
Drawing top view is fine. but front and side view camera isn’t rotated correctly.
how I fix the problem?
my code is below
// Top view
{
left: viewFullLeft,
top: viewMainHeight,
width: viewWidth,
height: viewHeight,
background: new THREE.Color(22 / 256.0, 22 / 256.0, 22 / 256.0),
// up: [0, -1, 0],
up: [0, 1, 0],
fov: 70,
camera: undefined,
updateCamera: function (camera, objectPosition, objectAngle) {
camera.position.set(objectPosition.x, objectPosition.y+10, objectPosition.z);
camera.lookAt(objectPosition);
camera.rotation.z = objectAngle + Math.PI;
}
},
// front view
{
left: viewFullLeft + viewWidth,
top: viewMainHeight,
width: viewWidth,
height: viewHeight,
background: new THREE.Color(22 / 256.0, 22 / 256.0, 22 / 256.0),
// up: [0, 1, -1],
up: [0, 1, 0],
fov: 70,
camera: undefined,
updateCamera: function (camera, objectPosition, objectAngle) {
camera.position.set(objectPosition.x, objectPosition.y, objectPosition.z-10);
camera.lookAt(objectPosition);
camera.rotation.y = objectAngle + Math.PI;
}
},
// side view
{
left: viewFullLeft + 2*viewWidth,
top: viewMainHeight,
width: viewWidth,
height: viewHeight,
background: new THREE.Color(22 / 256.0, 22 / 256.0, 22 / 256.0),
up: [-1, 1, 0],
fov: 70,
camera: undefined,
updateCamera: function (camera, objectPosition, objectAngle) {
camera.position.set(objectPosition.x+10, objectPosition.y, objectPosition.z);
camera.lookAt(objectPosition);
camera.rotation.y = objectAngle-10/180*Math.PI;
}
}