pco38 Posted May 6, 2015 Share Posted May 6, 2015 Hello,I'am starting with babylon and I have a simple question.Is somebody could explain me or had an example that explains how to rotate an object by drag&drop the mouse?Thanks for your help... Quote Link to comment Share on other sites More sharing options...
Wingnut Posted May 8, 2015 Share Posted May 8, 2015 Hi pco38, welcome to the forum! Your question might be simple, but the solution is not so simple. Keep in mind that you can rotate on 3 different axes. Would you consider... standard drag = rotate around Y axisSHIFTED-drag = rotate around X axisCONTROL-drag = rotate around Z axis Thoughts? I did a little testing last night, using our Playground Drag Demo. Still testing various modified onPointerMove funcs. Stay tuned. And tell me what you think about the shifted-drag and control-drag stuff. You can also use a "gizmo".... a little tool that can pop-up near the mesh, and you can drag-rotate on IT. The nearby mesh "follows" the dragging done on the gizmo. (this is seen in modelers such as Blender and Max). *shrug* Talk soon, and welcome again. Quote Link to comment Share on other sites More sharing options...
pco38 Posted May 8, 2015 Author Share Posted May 8, 2015 Hi Wingut, Thank you for your answer. I will try to test a solution based on the PlayGround Drag demo. To complete my question, my problem is to rotate a flat object like a disk on it's perpendicular axis. To control the opening or the closing of a valve for instance. Another question, Is there a function to convert 3D coordinate to screen coordinate ? Congratulation for the babylon developers that have done a very good ! Quote Link to comment Share on other sites More sharing options...
Wingnut Posted May 9, 2015 Share Posted May 9, 2015 Hi again! http://playground.babylonjs.com/#1HXY4E This is a "drag-scrub" rotater. Click on a mesh and hold the button down, then move the mouse around (scrub). The mesh rotates... in one direction. Not a very good drag-rotater, eh? I agree. Maybe it will work for your need. I will keep trying to think of better ways. I might try leftButton-hold to rotate left, rightButton-hold to rotate right (when done atop a mesh). Or, maybe not. Maybe others will have ideas, too. Be well. Quote Link to comment Share on other sites More sharing options...
pco38 Posted May 9, 2015 Author Share Posted May 9, 2015 Hi Wingnut,Thanks for your help, your example can be applied to resolve my problem :-)Please, inform me if you have some other solutions ;-)Best regards, Wingnut 1 Quote Link to comment Share on other sites More sharing options...
Pawel W Posted January 8, 2016 Share Posted January 8, 2016 On 5/8/2015 at 8:52 PM, Wingnut said: http://playground.babylonjs.com/#1HXY4E This is a "drag-scrub" rotater. Click on a mesh and hold the button down, then move the mouse around (scrub). The mesh rotates... in one direction. Not a very good drag-rotater, eh? I agree. Maybe it will work for your need. Hello there, if anyone needs rotating 3D objects in both directions, here it is: http://playground.babylonjs.com/#1HXY4E#3 Wingnut 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.