Question - Continuous Orbit, Pan and Zoom.
-
With ruby, it is possible to make a Continuous Orbit command? Like holding the mouse button, and have the effect of the mouse wrap around screen edges to orbit the model continuously, without having to click again with the mouse button. And can the same be done with zoom an pan?
I tried to make a autohotkey script but as soon as the mouse cursor wrap arround one screen edge to another the mouse position change and the orbit jumps to the initial angle. -
No, I don't think such a thing is possible in Ruby. Maaybe someone whose a lot smarter than myself could hack something together using some special windows hacking, but I'm not convinced that is even possible.
-
After some research I think the same, in blender this behavior is build in and the cursor is wrap around the view port, I think it can´t be done in ruby except with the help of some external program maybe. Thank you for your response.
-
It can be done. At least continuos rotation.
The cursor won't wrap to the other side of the screen but rotation continues "beyond the screen edges".
I have it working in a internal script of mine. Can't post the whole thing but here are some code snippets of the core part:#Snippets, not a full script def curve(new, old, increments) if (increments == 0) return(new) end @diff = (old-new) @sign = sgn(@diff) @slip = (@diff)/increments old -= @slip if(@sign != sgn(@diff)) return(new) end return(old) end# def sgn(x) if (x < 0) x = -1.to_i end if (x = 0) x = 0.to_i end if (x > 0) x = 1.to_i end return(x) end#sgn def update #Camera look @dx = curve(@mouseX-@lastx, @dx, 1) @dy = curve(@mouseY-@lasty, @dy, 1) @dx *= 0.005 #Pan speed @dy *= 0.005 #Tilt speed pan = Geom;;Transformation.rotation @eye, @worldUp, -@dx.degrees tilt = Geom;;Transformation.rotation @eye, @xaxis, -@dy.degrees new_target = @target.transform! pan new_target = new_target.transform! tilt pan = [0,0,0] #Resetting the pan values tilt = [0,0,0] #Resetting the tilt values target = new_target #Transform camera @camera.set(@eye, target, @worldUp) end#update def onMouseMove(flags, x, y, view) @mouseX = x @mouseY = y end#onMouseMove def onLButtonDown(flags, x, y, view) @lastx = x @lasty = y end#onLButtonDown
-
Hi, Pixero. I have a same problem with continous orbit. I read many post some other sketchup forums about this and just found your post now. You made this script? Can you send the fully working script? thank you and sorry for my english (i have problem with the grammar)
Zoltan
Advertisement