sketchucation logo sketchucation
    • Login
    šŸ¤‘ SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    Question - Continuous Orbit, Pan and Zoom.

    Scheduled Pinned Locked Moved Plugins
    5 Posts 4 Posters 674 Views 4 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • J Offline
      jaceguay
      last edited by

      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.

      1 Reply Last reply Reply Quote 0
      • Chris FullmerC Offline
        Chris Fullmer
        last edited by

        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.

        Lately you've been tan, suspicious for the winter.
        All my Plugins I've written

        1 Reply Last reply Reply Quote 0
        • J Offline
          jaceguay
          last edited by

          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.

          1 Reply Last reply Reply Quote 0
          • PixeroP Offline
            Pixero
            last edited by

            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
            
            
            1 Reply Last reply Reply Quote 0
            • D Offline
              DZoltan
              last edited by

              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

              1 Reply Last reply Reply Quote 0
              • 1 / 1
              • First post
                Last post
              Buy SketchPlus
              Buy SUbD
              Buy WrapR
              Buy eBook
              Buy Modelur
              Buy Vertex Tools
              Buy SketchCuisine
              Buy FormFonts

              Advertisement