sketchucation logo sketchucation
    • Login
    🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    Sketchup game

    Scheduled Pinned Locked Moved Developers' Forum
    3 Posts 2 Posters 451 Views 2 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.
    • D Offline
      Dhruv
      last edited by

      I am building my own code over Prince IO game tht Scott released before few days.

      At the moment I want to do two things

      1. How can I load different .skp files to my game from webdialogue?(I want to do this cause I dont want to go every time to drop down menu from plugins and load the map)
      2. How can I open a web - browser by left clicking on the model? (Something like onclick function from maybe dynamic components)

      Thank you,
      Dhruv Adhia

      1 Reply Last reply Reply Quote 0
      • D Offline
        Dhruv
        last edited by

        Well I asked him and he told me to post it on forums. I guess he must be busy , he told me that you will have to create your own ruby script and I just started learning ruby.

        1 Reply Last reply Reply Quote 0
        • chrisglasierC Offline
          chrisglasier
          last edited by

          @dhruv said:

          1. How can I load different .skp files to my game from webdialogue?(I want to do this cause I dont want to go every time to drop down menu from plugins and load the map)

          Not truly professional I'm sure but this works

          
          
          #RUBY
          @dlg.add_action_callback("load") {|d, p|
          	a= p.split(",")
          	
          	subDir ="Components/NamesetComponents/"
          	fileName = a[0]+".skp"
                
          	model = Sketchup.active_model
          	entities = model.active_entities
          	
          	theX = Integer(a[1]).mm
          	theY= Integer(a[2]).mm
          	theZ = Integer(a[3]).mm
              
          	point = Geom;;Point3d.new theX,theY,theZ
          	txyz = Geom;;Transformation.new point
                   
                   path = Sketchup.find_support_file fileName, subDir
                
          	definitions = model.definitions
          	componentdefinition = definitions.load path
          	instance = entities.add_instance componentdefinition, txyz
          		
          	theDegrees = Integer(a[4]).degrees
          	theAxis = a[5]
          	
          	rv = Geom;;Vector3d.new(0,0,1) if theAxis == "z"
          	rv = Geom;;Vector3d.new(0,1,0) if theAxis == "y"
          	rv = Geom;;Vector3d.new(1,0,0) if theAxis == "x"
          	
          	tr = Geom;;Transformation.rotation(Geom;;Point3d.new(instance.bounds.center), rv, theDegrees)
          	
          	instance.transform! tr   }
          
          //JAVASCRIPT
          
          function loadSkpFile(){
          
          param = new Array(theFile,theX,theY,theZ,rz,theAxis)
          
          param = param.join(",")
          
          window.location.href = 'skp;load@'+param     }  
          

          @dhruv said:

          1. How can I open a web - browser by left clicking on the model? (Something like onclick function from maybe dynamic components)

          As I understand it, you can do it with a selection observer, but I haven't figured out the code for that.

          Hope this is useful.

          Chris

          With TBA interfaces we can analyse what is to be achieved so that IT can help with automation to achieve it.

          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