Interactively rotate object without MatrixTransform node

(Alew) #1

I’m working on an application for interacting with models using a Kinect sensor. I’ve implemented a Cinder webview that interfaces with the Sketchfab Viewer API. None of my models has a MatrixTransform node, so I can’t use the rotateTo() function. I’m using the lookat() function to emulate rotating the object with camera positioning, but this workaround has a couple limitations. Is there any way to rotate the entire scene without relying on MatrixTransform nodes? Alternatively, can MatrixTransform nodes be added to a model, without re-creating it?

(Paul Sketch) #2


For this specific use case you can try with

 if ( api.getRootMatrixNode ) {
        api.getRootMatrixNode( function ( err, id, m ) {

            rootNode = id;
            rootTransform = m;

            console.log( 'RootMatrixNode', id );
        } );

then setting

clientApi.setMatrix( rootNode, m );

where m is a matrix4x4 should work

(Alew) #3

Hi Paul, thanks for the quick reply. I’m not too familiar with using matrices to manipulate objects, so I tried applying rotateTo() to the returned RootMatrixNode. That seemed to rotate the model around the scene’s global axis - is there a way to “anchor” a model so that it initially sits at the origin?

(Paul Sketch) #4

Each artist set their mesh position in their own pipeline tools, unless they set it up correctly, we can’t do much ?