Sketchfab Forum

Move object using buttons/keys


(Slawomir Hylinski) #1

I have two object on the scen. Can I move one of them? I see exaple with rotating eye but a want move only one object useing some button or key. It is possible?


There are some undocumented functions in the Viewer API:

translate( [nodeID], [translateTo], [duration], [easing], [callback] )

rotate( [nodeID], [rotateTo], [duration], [easing], [callback] )

getMatrix( nodeID, callback )

    Returns the transform matrices for a given node.
    The callback will be passed (err, matrices).

setMatrix( nodeID, matrix, [duration], [callback] )

    Sets the transform matrix of a given node.
    The callback will be invoked with no parameter.

You could use these to move an object and bind it to some button/key event.

(Slawomir Hylinski) #3

Thx very much.

Can I create my polygon using API?

The sensitivity of the mouse (scroll and rotate camera) is depends on the size of scen. Can I set camera sensitivity to a litlle object on te huge scen?


There's currently no way to create geometry or change the camera sensitivity, sorry!

(Sepehr 9210) #5

I have been looking for a way to rotate my models through the API.
The rotate function should do the job.
I couldn't find a reference to these anywhere else. Have you documented them already?
Do you have the API source code online to check the undocumented functions there?


I know @klaasnienhuis has a working demo of rotation and translation, but I don't think it can be shared publicly right now.

And there's a translation demo "game" here:

(Moroplogo) #7

I played with this game and after some practice, we can get a score above 500


Wow, nice high score :stuck_out_tongue:

(Moroplogo) #9

Yes .... and you can..... easily