💡 LightUp 7.1 | SketchUp's only real-time renderer that uses object-based rendering
Download Trial
Sketchup game
-
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
- 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)
- 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 -
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.
-
@dhruv said:
- 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:
- 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
Advertisement