Forum

Rotate an object with a fixed camera position

25 July 2017 18:06
Hi again :)

By default Blend4Web allows a user to control a camera, while object stays in fixed position.
The question: is it easily possible to make it behave different - camera is in fixed position, but user is able to rotate (with a mouse) the object itself around it's center.

I've found a transform module: https://www.blend4web.com/api_doc/module-transform.html
It allows to set rotation with all coordinates, but I need then add event listeners for mouse actions, trace the movement and then calculate the according coordinates.

But before I dive into it, I'd like to know, maybe there is already some setting, that allows such a manipulation out-of-the-box?
25 July 2017 18:31
Not really out of the box. But if you have a simple scene, you could parent everything to the camera except for you target object. This would not work if you have a large and complex scene. If you need to do it at run-time, the objects in your scene could be parented to one empty, you could then use append_stiff_trans() to append it to the camera and remove() to decouple it.
 
Please register or log in to leave a reply.