Move camera to a specific point

16 September 2015 01:36

I am new to blend4web.

In my project I have a new point in space generated on every frame in form of X, Y and Z coordinates. How can I move my active camera to that new point?

Pseudo code:

cameraX = 0;
cameraY = 0;
cameraZ = 0;

function onEnterFrame(){ // <- this function called every frame
cameraX += random(1…10);
cameraY += random(1…10);
cameraZ += random(1…10);
MoveActiveCameraTo( cameraX, cameraY, cameraZ );
16 September 2015 10:18
Nice to meet you Serge and welcome to this forum!

The exact API methods depend on your camera type (i.e. TARGET, EYE, HOVER or STATIC).
For example, in order to set position of a TARGET camera, you can use the set_trans_pivot() method of the camera module.
Please see these code snippets to get an idea about how to use the camera API:

Feel free to ask further questions.
The Founder | Twitter | Facebook | Linkedin
Please register or log in to leave a reply.