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

    MSPhysics tests and questions

    Scheduled Pinned Locked Moved Plugins
    104 Posts 21 Posters 44.7k Views 21 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.
    • A Offline
      Anton_S
      last edited by

      You can rely on MSPhysics::Body.#contacts function. Add this code to an iceberg to see the effect:

      onTick {
        if this.get_velocity.length > 1.0 && frame % 10 == 0
          this.contacts(true).each { |contact|
            body = simulation.emit_body(@@splash4, contact.point, @@dir, 0.4)
            body.collidable = false
          }
        end
      }
      
      1 Reply Last reply Reply Quote 0
      • F Offline
        faust07
        last edited by

        The script works in this form good for a few objects. The falling pieces of an iceberg touch each other and produce emitting objects everywhere in the air in mass. SketchUp crashes then ... It would be good if I could use instead of .each a certain surface for the contact. Another problem is that all splashes are created simultaneously. Therefore a script for a random time point of emitting would be very helpful. I'll try this...

        1 Reply Last reply Reply Quote 0
        • F Offline
          faust07
          last edited by

          After I have tried several things and have not come to any satisfactory result, I have a suggestion:
          It would be great to have a kind of "Penetration Joint" or function (onPenetration):
          to connect it to one or more noncollidable objects (or faces).
          The properties of objects that penetrate this noncollidable object are to be evaluated continuously:
          name, mass, velocity, position of the touch/penetration, direction of movement, etc..
          In other words, please bring back the old onTouch bug as an independent function!

          1 Reply Last reply Reply Quote 0
          • F Offline
            faust07
            last edited by

            I finally found a satisfactory solution for my imitated water fun in MSPhysics v1.0.2:
            A combination of a surface with onTouch function (water surface) and an evaluation of velocity.lenght (onTouching event) and contact.points of in the area of this surface moving objects.
            Anton, thank you for the examples, hints and help!


            OnTouch-0001.gif

            1 Reply Last reply Reply Quote 0
            • F Offline
              faust07
              last edited by

              Hi Anton,
              I want to bring more variation into the particles of the orca's breathing air. My intended scaling function does not show any reaction. What can be the cause? Can't scripted emitted objects not be scaled during simulation?

              
              for i in 1..20 do
                tra = this.group.transformation
                dir_zsf = tra.zaxis
                dir_zsf.length = 290 + rand(100)
                fount_p = Geom;;Point3d.new(0.0 + rand(-5..5), 2.9.m + rand(20), 0.5.m + rand(15)) # y-pos of fountain
                point = fount_p.transform(tra)
                transl = Geom;;Transformation.new(point)
                scalin = Geom;;Transformation.scaling point, rand(1..5)     
                transf = scalin * transl
                if point.z > 0.1.m
                  body = simulation.emit_body(@@splashF, transf, dir_zsf, 0.2)
                  body.collidable = false
                end
              end
              
              

              OnTouch-Test_21_V102.gif

              1 Reply Last reply Reply Quote 0
              • F Offline
                faust07
                last edited by

                The next step is to find a solution to bridge the gaps that arise between the moving parts of the objects at the pivot points.
                I think of flexible triangular or square surfaces, which I can clamp between the boundary lines of the moving parts. For this I have to immerse deeper into the Ruby programming of SketchUp geometry ...
                If someone from the experts has ideas, I would be very happy.


                OnTouch-Test_19_V102.gif


                and how it looks like rendered with indigo RT

                1 Reply Last reply Reply Quote 0
                • F Offline
                  faust07
                  last edited by

                  Hello Anton, here an other little question:
                  When I let run "Replay" with active hidden geometry all emitted objects remain in there last position still after there lifetime. Is this normal? Could that explain why Twilight takes longer and longer to render the images during the simulation?


                  Flexi-Joint_SUp_07.gif


                  Emitter_Hidden-Geometrie_02.jpg

                  1 Reply Last reply Reply Quote 0
                  • A Offline
                    aldoz8
                    last edited by

                    Hi, I hope I am in the right place to put my question..

                    I am developing a quadruped robot:
                    https://www.youtube.com/watch?v=bt_8X4lYDGY

                    So I am using SketchUP make 2017 + MSPhysics to test different settings of my robot and different scenarios :
                    https://www.youtube.com/watch?v=fBTxNx2UAT8

                    Just cool! but I have a little problem:
                    In Sketchup I am using 8 servos, 2 for each legs and I get (as you can see in the second video) 8 MSPhysics sliders to move my 8 servos.
                    Ok, but I would to have another slider that let me to move, for example, servos 3,4 and 5.
                    So I would to obtain my actual 8 sliders + 1 new sliders that move servos 3,4 and 5.
                    Obviously I will be able to move servo 3,4 and 5 using both the old 3,4&5 sliders and the new one slider too!
                    So I will obtain :
                    SLIDER 1 = servo 1
                    SLIDER 2 = servo 2
                    SLIDER 3 = servo 3
                    SLIDER 4 = servo 4
                    SLIDER 5 = servo 5
                    SLIDER 6 = servo 6
                    SLIDER 7 = servo 7
                    SLIDER 8 = servo 8
                    SLIDER 9 = servo 3, 4, 5

                    How to do that?
                    Thank you all in advance!

                    1 Reply Last reply Reply Quote 0
                    • ecatiE Offline
                      ecati
                      last edited by

                      aldoz8
                      If you can not find a solution, do you share the skp file?

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

                        I downloaded MS Physics plugin after seeing a demo from Justin's SketchUpEssentials. Looks really cool, but is it really compatible with Mac? It says it is, but following the tutorials on Youtube, all the setup modes seem to function, but when it comes to implementation, the model disappears, and a counter on the bottom left hand of the screen counts ‘Frame’, Time and FPS. Goes on forever! Is this normal?

                        Box, on the SketchUp Forum looked at the model for me on a PC, and then had similar issues, so suggested that this is not necessarily a Mac issue.

                        I am setting up a mobile (to hang above a baby's cot) with rotating discs balanced on a simple rod. Each disc then has to be able to swivel on its vertical axis, each group would then too, and then including the main arm holding all the groups has to be able to swivel on its axis.

                        Can Anybody offer some advice.

                        Thanks
                        Jens

                        1 Reply Last reply Reply Quote 0
                        • F Offline
                          faust07
                          last edited by

                          Judging from the description, objects outside the window seem to fall into the bottomless state and cause the SketchUp clipping problem. All groups or components that should not be simulated should be set to "Ignore" or "Static". This can be done in the MSP user interface or in the MSP context menu. A sample SUp model is always very helpful for more precise assessments.

                          1 Reply Last reply Reply Quote 0
                          • F Offline
                            faust07
                            last edited by

                            @ aldoz8:
                            There is no easy solution for this after my first tests. Each slider can directly control only one joint (and several identical copies of the joint) at a time. It is possible to use scripts to query the input values from a slider and pass them on to the required other joints. Unfortunately, I don't have time for an example. Sorry!

                            1 Reply Last reply Reply Quote 0
                            • ecatiE Offline
                              ecati
                              last edited by

                              This is a message sent by mistake. It needs to be deleted. I did not delete it. Sorry.

                              1 Reply Last reply Reply Quote 0
                              • T Offline
                                tecnozati
                                last edited by

                                Hello everyone, to see if a charitable soul can help me out.
                                Using MSPhysics script I want to get:
                                1 know the position of a servo join
                                2 move the servo without using “get_var ()” as controller

                                I wish to animate a mechanism with scripting, I would greatly appreciate code examples (I find it almost impossible to find them)
                                Greetings and many thanks

                                1 Reply Last reply Reply Quote 0
                                • F Offline
                                  faust07
                                  last edited by

                                  There is a link to the Scripting Documentation in the first post of Anton_S regarding his MSPhysics plugin: https://sketchucation.com/forums/viewtopic.php?f=323&t=56852

                                  1 Reply Last reply Reply Quote 0
                                  • A Offline
                                    Anton_S
                                    last edited by

                                    tecnozati,

                                    Yeah, the docs do not have enough coding examples. But I intended to fix that someday.

                                    To get the position of a servo joint from a script field, you will first need to know the name/id of the joint, which is displayed in UI when you select the joint. Then you can write the following code:

                                    
                                    onStart {
                                      @j = simulation.find_joint_by_name("569422")
                                    }
                                    
                                    onTick {
                                      # Set desired angle
                                      if (key(' ') == 1) 
                                        @j.controller = 100.degrees
                                      else
                                        @j.controller = 0
                                      end
                                      
                                      # Get current angle
                                      simulation.log_line @j.cur_angle.radians
                                    }
                                    
                                    

                                    You can refer to servo docs for more functionality: https://www.rubydoc.info/github/AntonSynytsia/MSPhysics/MSPhysics/Servo

                                    Anton

                                    1 Reply Last reply Reply Quote 0
                                    • T Offline
                                      tecnozati
                                      last edited by

                                      😮 😮 Thank you, thank you, thank you! The head was going to burn me!
                                      And above all, thanks for Msphysics! 👍

                                      1 Reply Last reply Reply Quote 0
                                      • T Offline
                                        tecnozati
                                        last edited by

                                        Again, thanks Anton, I have managed to give life to my creature 😉

                                        1 Reply Last reply Reply Quote 0
                                        • A Offline
                                          Anton_S
                                          last edited by

                                          Dude great job!!!

                                          1 Reply Last reply Reply Quote 0
                                          • P Offline
                                            pppppppppppppppppppppppppppppluginuser
                                            last edited by pppppppppppppppppppppppppppppluginuser

                                            I have made a simple car and set a controller for the servos and motors but they don't respond. Any clue on how to fix? (controls are the arrow keys)


                                            Motor ui


                                            Servo ui


                                            Simple car


                                            Car Simulation.skp

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

                                            Advertisement