Hi Soft8soft team,
Is it possible to use the Vege3D API to set the camera? I tried a simple test, but I did not get the results that I expected.
I would like to be able to set the camera’s position and rotation from the JavaScript code. I could successfully set the position but the rotation of the camera would not update. Here is a sample of my code:
app.ExternalInterface.setCameraView = function(posName){
var cameraPositions = {
"FRONT_VIEW" : { "x" : 0.0, "y" : -5.0 , "z" : 5.0, "rotX" : 90, "rotY" : 0.0, "rotZ" : 0.0},
"RIGHT_VIEW" : { "x" : 5.0, "y" : 0.0 , "z" : 0.0, "rotX" : 90, "rotY" : 0.0, "rotZ" : 90}
}
var cam = v3dApp.scene.getObjectByName("Camera");
var camPos = cameraPositions[posName];
cam.position.set(camPos.x, 1 * camPos.z, -1 * camPos.y);
cam.rotation.set(camPos.rotX, camPos.rotY, camPos.rotZ);
}
The v3dApp var is a reference to the application. I set that elsewhere in my code.
Is there another way of doing this? A better way?
Thank you,
Jem