Forum

Restore default camera position

10 March 2016 20:01
Hi

I would like to restore the default position of the camera on click, after the user has moved it.
It's not a static or eye camera, and it has got limitations angles.

I was able to retrieve position, but don't know how to restore it, i'm lost with parallel translation…
Any way to make it simple???


var camera = m_scenes.get_active_camera();
var vec3_tmp = new Float32Array(3);
var pos = m_cam.get_translation(camera, vec3_tmp);
13 March 2016 10:28
It's not a static or eye camera, and it has got limitations angles.
So it is a target camera?

I assume, you have tried the set_translation method. It is used to give some delta to the current camera position. You need another method to set the exact camera location.

You can call for example this function. The third param is optional.
18 March 2016 13:23
Yes it's a target camera.
I'm 100% lost.
18 March 2016 13:49
i succeed, it was so simple… Thanks Evgeny Rodygin

I save the original position :
	
var camera = m_scenes.get_active_camera();
var trans = m_cam.get_translation(camera);
var pivot = m_cam.target_get_pivot(camera);


and when needed

setTranslation = m_cam.target_set_trans_pivot(camera,trans,pivot);

 
Please register or log in to leave a reply.