Hi
I tried to set a camera position by an variable, but didn’t find a solution in the doc. Is it possible to use a array variable for the vector3 position? like this it does not work:
var cameraposition1 = [’-800’,‘1000’,‘2700’];
camera.setPosition(new BABYLON.Vector3(Array(cameraposition1)));
I’m not very familiar with *.Vector3(Array(an-array-here)), so I’m not sure if that does not work because of the ‘Array’ thing, or because of the strings instead of numbers in your array. However, this should work:
var cameraposition1 = [800, 1000, 2700]; // Numbers, not strings
camera.setPosition(new BABYLON.Vector3(cameraposition1[0], cameraposition[1], cameraposition[2]);
Check the line where you are defining the camera position, as you are using two different variables: cameraposition1 and cameraposition. You have only defined cameraposition1 and that’s why the console is throwing that error, since cameraposition is not defined and you have used it to try to give a position to the camera.