Forum

where i can find the value of x,y, z for the camera position

13 July 2017 10:14
hi, my name is ruly, i am new to this blend4web, and i am exited to learn more of this app.
recently i open the code snippet for camera move style and then i see the source code of that app, and then i see a variable like this

var STATIC_POS = new Float32Array([-4.5, -3, 0.5]);
var STATIC_LOOK_AT = new Float32Array([-4.5, 0, 0]);

var EYE_POS = new Float32Array([-1.5, -3, 0.5]);
var EYE_LOOK_AT = new Float32Array([-1.5, 0, 0.5]);

var TARGET_POS = new Float32Array([1.5, -2, 0]);
var TARGET_PIVOT = new Float32Array([1.5, 0, 0]);

i know that variable is use for fill the parameter of the position of camera, what i want to ask is, where i can find that value for x,y , and z axis ?
13 July 2017 10:40
Hi, welcome to the forum.
Take a look at get_translation() (in Camera module) and see if that is what you are after. There are a number of functions that might you might also find helpful in the Transform API.
Code example from get_translation(). (in Transform module)
var m_scenes = require("scenes");
var m_trans = require("transform");
var m_vec3 = require("vec3");
// precache 3D vector
var _vec3_tmp = m_vec3.create();
// ...
var cube = m_scenes.get_object_by_name("Cube");
var translation = m_trans.get_translation(cube, _vec3_tmp);
 
Please register or log in to leave a reply.