sketchucation logo sketchucation
    • Login
    1. Home
    2. CPhillips
    3. Posts
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    ⚠️ Important | Libfredo 15.6a introduces important bugfixes for Fredo's Extensions Update
    C
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 68
    • Posts 1,089
    • Groups 1

    Posts

    Recent Best Controversial
    • RE: WIP: Scripted aircraft

      Recently I was thinking about simulating wings. It think it is possible to script (in SP3x) a "wing". It would be an object that would use its past and current position,rotation and speed to figure out angle of attack. Once you have that you could easily figure out lift and drag and use push() to make it act something like a real wing. Connect to a body with a thruster and you get a plane. Connect them with servos and you could make ailerons and rudder.

      In theory. πŸ˜„

      posted in SketchyPhysics
      C
      CPhillips
    • RE: SketchyPhysics 3x June 27 version.

      @wacov said:

      @unknownuser said:

      Never really got back to this one: Are we going to be able to set an object's scripting from an external source code?(ie setting an emitted object to explode on impact.)

      Any SU ruby would work, ao you might be able to load an external .rb file as an ontick func, or whatever. But you don't need that to do what you're asking, as Jav has shown; and anything that SU can detect can be acted upon.
      Hi everyone. Sorry I have been quiet lately. Been taking some time off and enjoying the summer.

      I think it is possible to set events externally with this version. I know the the syntax is a bit weird and I plan to clean it up.

      Create a good sized cone and put this in its scripted field.

      b=copy
      b._setEvent("ontick",
      <<CODE
         push([0,0,1])#go forward
         if(frame>50)
            destroy #die after 50.
         end
      CODE
      )
      

      The cone will copy itself and then set the "ontick" event in the copy.

      I tried to make an example that uses "ontouch" but it didnt work for some reason. I will have to debug it.

      posted in SketchyPhysics
      C
      CPhillips
    • RE: Chrome for Debugging

      Check out Firebug lite.

      http://getfirebug.com/lite.html

      It works for IE and Safari. All you have to do to debug your Webdialogs is add this line to your HTML:

      <script type='text/javascript' src='http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js'></script>
      
      
      posted in Developers' Forum
      C
      CPhillips
    • RE: [Plugin] triangulateFaces.rb v1.2 20101120

      Post the code and I'll have a look. It might be the face.mesh(1). I think you need to use a different number when you want back uv's as well.

      posted in Plugins
      C
      CPhillips
    • RE: [Plugin] triangulateFaces.rb v1.2 20101120

      @tig said:

      @cphillips said:

      I needed the triangulation to prepare a model for export.

      Thanks for incorporating it into your script TIG! Why is it that back facing UV's didn't work?

      There is only a method to 'place material textures on a face' - and that assumes a 'front_face' - there's no 'back_face' method...

      Do you mean position_material? It takes a bool for front or back material

      http://code.google.com/apis/sketchup/docs/ourdoc/face.html#position_material

      posted in Plugins
      C
      CPhillips
    • RE: [Plugin] triangulateFaces.rb v1.2 20101120

      I needed the triangulation to prepare a model for export.

      Thanks for incorporating it into your script TIG! Why is it that back facing UV's didn't work?

      posted in Plugins
      C
      CPhillips
    • RE: [Plugin] triangulateFaces.rb v1.2 20101120

      I finally figured out how to triangulate any face without the side effect of filling holes.

      def triangulateFace(face)
          mesh=face.mesh(1)
          faces=mesh.polygons
          verts=mesh.points
          uvs=mesh.uvs(true)
          outmesh = Geom;;PolygonMesh.new
          faces.each{|f|
              outmesh.add_polygon(verts[f[0].abs-1],verts[f[1].abs-1],verts[f[2].abs-1])
          }
          ents=Sketchup.active_model.active_entities
          mat=face.material
          face.erase!
          grp = ents.add_group
          grp.entities.add_faces_from_mesh(outmesh)
          grp.entities.each{|e|
              if(e.class==Sketchup;;Edge)
                  e.smooth=false
                  e.soft=false            
              elsif(e.class==Sketchup;;Face && mat!=nil)
                     #handle materials and uvs.
                  uva=verts.index(e.vertices[0].position)
                  uvb=verts.index(e.vertices[1].position)
                  uvc=verts.index(e.vertices[2].position)
                  e.material=mat
                  e.position_material(mat,[verts[uva],uvs[uva],verts[uvb],uvs[uvb],verts[uvc],uvs[uvc]],true)
              end
          }
          grp.explode
      end
      
      posted in Plugins
      C
      CPhillips
    • RE: [Plugin] triangulateFaces.rb v1.2 20101120

      Here is the method I use:

      
      def triangulateFace(face)
          ents=Sketchup.active_model.active_entities
          faces=face.mesh.polygons
          verts=face.mesh.points
          faces.each{|f|
              ents.add_line(verts[f[0].abs-1],verts[f[1].abs-1])
              ents.add_line(verts[f[1].abs-1],verts[f[2].abs-1])
              ents.add_line(verts[f[2].abs-1],verts[f[0].abs-1])
          }       
      end
      
      

      The nice thing is it cant fail to triangulate regardless of the shape or number of holes. But it unfortunately adds faces to the "holes". Or rather Sketchup does. Does anyone a way to add an edge without Sketchup attempting the "heal" the face?

      posted in Plugins
      C
      CPhillips
    • RE: Particle FX preview

      @javixp said:

      @wacov said:

      If you mean give it a velocity, sure

      Can you increase my FPS then? πŸ˜„

      It sounds pretty cool. Can you upload another .skp model to see if it runs faster?

      You might want to check your video settings and make sure that you have Hardware acceleration turned on. Also maybe update your video drivers.

      posted in SketchyPhysics
      C
      CPhillips
    • RE: Sketchyphysics joints.. How do i use them ???

      Look for the tutorial in the sticky posts at the top of the forums. There you will also find links to the wiki and other information.

      posted in SketchyPhysics
      C
      CPhillips
    • RE: Slider Trickery?

      Probably. But I need more info on how the object is expected to move. Can you give a better description or maybe a image?

      posted in SketchyPhysics
      C
      CPhillips
    • RE: Particle FX preview

      Open up the ruby console and see if it is printing any errors.

      posted in SketchyPhysics
      C
      CPhillips
    • RE: SketchyPhysics + SketchUp API = fun

      Its like snow. Nice model BTM!

      posted in SketchyPhysics
      C
      CPhillips
    • RE: Groups flipping

      Wacov that is the best rundown I have seen. I like the "simulation cry" bit.πŸ˜„

      posted in SketchyPhysics
      C
      CPhillips
    • RE: SketchyPhysics 3x June 27 version.

      Here is another useful script. It allows scripts to print text to the screen. In this case a log of whatever touches the floor.

         #add blank text to screen at 10,50
      @@log=SketchyPhysics;;addWatermarkText(10,50,"")
         #place to store lines
      @@lines=[]
      
      ontouch{|t,s,p|
            #add new line
         @@lines.push(t.name+" touched "+self.name)
      
            #ensure only 5 lines on screen at once.
         @@lines.shift if @@lines.length>5
            #display lines
         @@log.text=@@lines.join("\n")
      
      }
      
      onend{
         @@log.erase!
         @@lines=nil
      }
      

      logging.skp

      posted in SketchyPhysics
      C
      CPhillips
    • RE: SketchyPhysics 3x June 27 version.

      I removed double click = kick because it was seldom used and interfering with the new events.

      posted in SketchyPhysics
      C
      CPhillips
    • RE: SketchyPhysics + SketchUp API = fun

      Wow! BTM that is truly amazing. It looks like that BMW commercial. The script is much simpler than I expected.

      posted in SketchyPhysics
      C
      CPhillips
    • RE: SketchyPhysics 3x June 27 version.

      This script is inspired by a new model on 3dwarehouse that ran really smooth... once I turned off shadows and edges.

      Paste this into one objects scripted field. It tries to speed up the rendering by disabling shadows and edges during the simulation. Don't worry if you dont understand it. It should be plug and play.

      onstart{
            #save current settings
         ropts=Sketchup.active_model.rendering_options
         sopts=Sketchup.active_model.shadow_info
         @saveROpts=ropts.collect{|k,v|[k,v]}
         @saveSOpts=sopts.collect{|k,v|[k,v]}
      
            #changes to speed up render
         ropts["EdgeDisplayMode"]=0
         sopts["DisplayShadows"]=false
      
      }
      onend{
            #restore render settings.
         @saveROpts.each{|k,v|; Sketchup.active_model.rendering_options[k]=v}
         @saveSOpts.each{|k,v|; Sketchup.active_model.shadow_info[k]=v}
      }
      

      Original model. http://sketchup.google.com/3dwarehouse/details?mid=3107b3d9c4c935b2b006aed51312d6bb&prevstart=0

      posted in SketchyPhysics
      C
      CPhillips
    • RE: SketchyPhysics 3x June 27 version.

      @wacov said:

      Chris, it seems if there's a script error in onend, objects fail to move back to their starting positions... and it can't be undone πŸ˜• Try sticking jargon in onend, and see for yourself.

      Thanks. I fixed it.

      posted in SketchyPhysics
      C
      CPhillips
    • RE: SketchyPhysics 3x June 27 version.

      I was going to do an example for split, but it turns out there are some more bugs with it. It wont work in "onstart" for example. use this instead:

      ontick{
         if(frame==1)
            split(self,2)#break into 4 pieces 
            ontick{} #disable ontick
         end
      }
      
      posted in SketchyPhysics
      C
      CPhillips
    • 1 / 1