• Login
sketchucation logo sketchucation
  • Login
ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

SketchyPhysics 3x June 27 version.

Scheduled Pinned Locked Moved SketchyPhysics
95 Posts 12 Posters 23.0k Views 12 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.
  • C Offline
    CPhillips
    last edited by 8 Jul 2009, 23:44

    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

    1 Reply Last reply Reply Quote 0
    • J Offline
      JaViXP
      last edited by 11 Jul 2009, 14:08

      Very nice script! πŸ‘

      Can we upload with this version if we don't use the new features? πŸ˜‰

      "Giving up is way harder than trying"
      JaViXP's Rendering

      1 Reply Last reply Reply Quote 0
      • P Offline
        Physicsguy1
        last edited by 9 Aug 2009, 04:56

        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.)

        1 Reply Last reply Reply Quote 0
        • J Offline
          JaViXP
          last edited by 9 Aug 2009, 11:50

          Nice question, what do you want it for? πŸ˜‰

          Something like this should work (this one doesn't work, just play around with it):

          
          ontouch{|toucher,speed,pos|
             if(toucher.name=="box"){
                split(self,1)
          }
             end
          }
          

          Hope this helps! πŸ˜„

          "Giving up is way harder than trying"
          JaViXP's Rendering

          1 Reply Last reply Reply Quote 0
          • W Offline
            Wacov
            last edited by 9 Aug 2009, 12:11

            @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.

            http://sketchup.google.com/3dwarehouse/cldetails?mid=3096a836877fb9af6cd8ad826e9017b8&prevstart=0

            1 Reply Last reply Reply Quote 0
            • C Offline
              CPhillips
              last edited by 9 Aug 2009, 21:48

              @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.

              1 Reply Last reply Reply Quote 0
              • N Offline
                NorviewsVeteran
                last edited by 20 Aug 2009, 07:05

                Sorry I don't have much to add, but there are a few things. I'm no programmer, I'm on the mechanical team.

                1. You guys are blowing my mind. Wacov, when I opened your cloth file my jaw dropped for so long I almost drooled on my cat.

                @unknownuser said:

                Can we upload with this version if we don't use the new features?

                1. I needed an excuse to upload the Gopher.

                Gopher Armored Car.skp

                ```
                //This_Is_All(I)+=Know()About.Code;
                ```

                1 Reply Last reply Reply Quote 0
                • C Offline
                  CPhillips
                  last edited by 21 Aug 2009, 05:06

                  Nice model!

                  1 Reply Last reply Reply Quote 0
                  • N Offline
                    NorviewsVeteran
                    last edited by 22 Aug 2009, 06:00

                    Thank you, have another.

                    I figured out the scripted joints (big for me) to the point where I used universal joints for the bogies and you can copy more cars to the train, but the problem is I had to daisychain the joints under the cars so much the sag makes the cars lean in turns. Just beware of derails, they seem to be quite frequent...

                    If anyone can figure out a way around this, that would be great.


                    train.skp

                    ```
                    //This_Is_All(I)+=Know()About.Code;
                    ```

                    1 Reply Last reply Reply Quote 0
                    • W Offline
                      Wacov
                      last edited by 27 Aug 2009, 17:41

                      @norviewsveteran said:

                      1. You guys are blowing my mind. Wacov, when I opened your cloth file my jaw dropped for so long I almost drooled on my cat.

                      🀣

                      @cphillips said:

                      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.

                      It totally crashes my SU when I try it in ontouch, and freezes the sim in ontick... also, I can't drag the original object. It highlights, and the drag line appears, but no movement πŸ˜•

                      http://sketchup.google.com/3dwarehouse/cldetails?mid=3096a836877fb9af6cd8ad826e9017b8&prevstart=0

                      1 Reply Last reply Reply Quote 0
                      • P Offline
                        Physicsguy1
                        last edited by 27 Aug 2009, 18:52

                        @unknownuser said:

                        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.

                        Err... looks like you didn't try it in the right field.

                        1 Reply Last reply Reply Quote 0
                        • W Offline
                          Wacov
                          last edited by 28 Aug 2009, 14:17

                          I mean ontick/touch as in:

                          ontick{
                          ...
                          }
                          

                          Try it, see what you get.

                          http://sketchup.google.com/3dwarehouse/cldetails?mid=3096a836877fb9af6cd8ad826e9017b8&prevstart=0

                          1 Reply Last reply Reply Quote 0
                          • C Offline
                            CPhillips
                            last edited by 4 Sept 2009, 22:55

                            I am not 100% sure that works in this version. It may depend on some unreleased code. Can anyone confirm it works?

                            1 Reply Last reply Reply Quote 0
                            • P Offline
                              Physicsguy1
                              last edited by 6 Sept 2009, 01:20

                              It works for me.

                              1 Reply Last reply Reply Quote 0
                              • J Offline
                                JaViXP
                                last edited by 6 Sept 2009, 13:44

                                Same for me.

                                "Giving up is way harder than trying"
                                JaViXP's Rendering

                                1 Reply Last reply Reply Quote 0
                                • W Offline
                                  Wacov
                                  last edited by 6 Sept 2009, 15:02

                                  It works for me, just not in any events.

                                  http://sketchup.google.com/3dwarehouse/cldetails?mid=3096a836877fb9af6cd8ad826e9017b8&prevstart=0

                                  1 Reply Last reply Reply Quote 0
                                  • C Offline
                                    CPhillips
                                    last edited by 12 Sept 2009, 04:46

                                    @wacov said:

                                    It works for me, just not in any events.

                                    Not sure I understand. Can you post a model that fails and I will take a look.

                                    1 Reply Last reply Reply Quote 0
                                    • P Offline
                                      Physicsguy1
                                      last edited by 12 Sept 2009, 05:36

                                      BTW,(this may be a stupid question), but is there a way around the camera 'bending' situation where the camera eye overshots to some other point3D? I cant get any reliable camera systems...

                                      1 Reply Last reply Reply Quote 0
                                      • W Offline
                                        Wacov
                                        last edited by 12 Sept 2009, 11:01

                                        @cphillips said:

                                        @wacov said:

                                        It works for me, just not in any events.

                                        Not sure I understand. Can you post a model that fails and I will take a look.

                                        In Jun 27, putting your code inside a normal event (ontick{...}) crashes. It seems to work in the SVN version, though πŸ˜•

                                        http://sketchup.google.com/3dwarehouse/cldetails?mid=3096a836877fb9af6cd8ad826e9017b8&prevstart=0

                                        1 Reply Last reply Reply Quote 0
                                        • mariochaM Offline
                                          mariocha
                                          last edited by 22 Oct 2009, 02:11

                                          Hi, just to share 2 small animations done with SkPh-3.
                                          One is quite amusing, showing Emitter, Thruster and magnet
                                          http://www.youtube.com/watch?v=ea5KeZ7Turg
                                          the other shows pseudo-virus
                                          http://www.youtube.com/watch?v=Yb_D__3m_0w

                                          %(#008000)[Mario C.
                                          Every rule has exceptions, but some.]

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

                                          Advertisement