how to rotate a 3d model with multi-touch??
Hi,everyone.
I have a question about rotating a 3d model, here is my patch:
and this one is the tuio patch which should be in the same folder with mine:
My question is : I can make the model rotating if the finger keeps touching the screen when it moves, but what I really want is I release my finger any time, the model stop, when I touch the screen and move my finger again, the model can keep rotating from where its xy axes leaved.
I don't know if I make my question clear enough, my english is not very good.
anyway, Thank you all~
I suggest jit.eulerToQuat, when you want to make intuitive rotation, euler angles are usually easier to use, gl objects can be rotated with quaternions. Concerning the management of gesture, it's up to you to make a good structure of decision (scripting, patches...)
@NICOLASNUZILLARD thank you for your reply, I'll try jit.euler2quat.
but it seems use another representation of orientation can't solve my problem... I need a formula, or an
algorithm to achieve this: slide your finger on the screen, the 3d model will rotating horizontally or vertically(depends on the gesture ,finger move left to right,or up and down),when you release finger ,the model stop rotating. when you touch the screen (at any spot) and slider finger again, the model will rotate again from recent angel(x,y,z).
maybe I can't discrible it clearly with my english... but I believe everyone have seem this in a lot of games and apps on your phone/touch screen.
thanks again!
You are trying to describe a 3D rotation with a 2D motion, there are many ways to perform this kind of operation and it depends on the configuration of you sceen (camera, objects orientation, world or object coords ...). Maybe you want your tool to bahve like jit.gl.handler so you should studdy how it works and figure out whats happening. I still believe that at a certain point, you will need to descibe your rotation as a quaternion or a matrix, which is not intuitive, therefore using Euler angles might be a solution.
Nico
You can use jit.anim.node like in this example. Basically, when the touch begins you send a "turn" message to jit.anim.node: the distance of the touch movement sets the turn proportionally, as I simulated using the sliders.
@LSKA this is exactly what I looking for ! thanks a lot!
@NICOLASNUZILLARD thank you again! I'll consider your suggestion.