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

    DC Exploration 2 - Movement! (rotation, linear)

    Scheduled Pinned Locked Moved Dynamic Components
    sketchup
    19 Posts 9 Posters 9.5k Views 9 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.
    • Chris FullmerC Offline
      Chris Fullmer
      last edited by

      All right, I have another animated movement DC to post. Its not terribly fancy on the outside, but its still cool. I incorporated a new trick from Jim: You can have multiple functions take place inside of one OnClick command by separating them with a semicolon ; . So that is what this does.

      On one onclick, it calcualtes random values and stores them as Xholder, Yholder and Zholder attributes. Then in the same onclick, it takes those values and animates a new attribute called Xanim, Yanim, and Zanim. So I have those 3 attributes being animated based on randomly generated values. Then I have my X, Y, and Z equal those Nanim attributes so that my component is animated on all 3 axes simultaneously. Here is the full text of the onclick cell:

      set("xholder",(X+(randbetween(-100,100))));set("yholder",(Y+(randbetween(-100,100))));set("zholder",(Z+(randbetween(-100,100))));animateslow("xanim",xholder);animateslow("yanim",yholder);animateslow("zanim",zholder)

      so first it sets the attributes, then animates other attributes based on those set values. So when you click on the block, it jumps randomly around the screen.

      Chris

      I have a feeling there was a much simpler way to do this...anyone?


      random 3d aniatmied movement.skp

      Lately you've been tan, suspicious for the winter.
      All my Plugins I've written

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

        Did this "snake" as a challenge. It turned out to be not as hard to do as I thought. So I added his brother the "sidewinder".


        snake.skp


        sidewinder.skp

        Hi

        1 Reply Last reply Reply Quote 0
        • Chris FullmerC Offline
          Chris Fullmer
          last edited by

          Way cool Jim. Is that a Sin Wave? I admit the math you used is over my head, but it sure looks cool.

          Chris

          Lately you've been tan, suspicious for the winter.
          All my Plugins I've written

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

            @jim said:

            These (simple) legs were done by using sub-components and smart placement of the component's axes. By making the upper and lower parts sub-components of the leg, I didn't need to worry about their positions - rotating the parent leg rotates both the upper and lower parts together, no matter what their local position/rotation is.

            Then by placing the lower leg's axis at the top of the component (at the knee), I just had to set it's RotY attribute to make the lower part rotate.

            PS: Technically, this animation is only a half-stride.

            I've had someone ask why on this component you can't animate the legs directly using code such as:

            ANIMATE("Leg!RotY",45,-45)

            When you use this, the leg animates from 0 to -45 which is not as expected. I'm having trouble explaining it myself, so does someone know exactly what happens in this case?


            The modified file.


            The original file.

            Hi

            1 Reply Last reply Reply Quote 0
            • Q Offline
              Qverburg
              last edited by

              Thanks for helping finding the answer to my question here Jim!

              I had this problem a couple of times allready. mainly with opening windows and sortalike.
              Im happy with the workaround of Jim but I guess it shouldnt be necessary.

              I have some troubles with another DC of mine too. Will post it soon so you pro's can give it a look 😎

              Regards
              Quintus

              1 Reply Last reply Reply Quote 0
              • Q Offline
                Qverburg
                last edited by

                Hmm this is strange,

                I found this door example of Remus and in there a mix of positive and negative rotations works just fine!
                Maybe its a nesting problem.


                Door fix

                1 Reply Last reply Reply Quote 0
                • Chris FullmerC Offline
                  Chris Fullmer
                  last edited by

                  Scott commented on that once. I don't rememeber if he had an explanation, or if he just said that its buggy to animate the rotation/position/scale/ values directly, and that an intermediate value should be animated.

                  I don't remember if that comment was made here or elsewhere though. I'd be hard pressed to find it.

                  Chris

                  Lately you've been tan, suspicious for the winter.
                  All my Plugins I've written

                  1 Reply Last reply Reply Quote 0
                  • E Offline
                    ericschimel
                    last edited by

                    I'd like to throw my hat in here with this drawing....

                    This is what I used to create the logo for my website. I was going to use the animated gears for my videos, I just haven't implemented it yet....

                    Just magic finger the gears and you will see...


                    Dynamic Training Logo.skp

                    -Eric
                    http://plugin.sketchthis.net
                    Sketchup Kitchen Design Plugin
                    Custom Models

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

                      @jim said:

                      These (simple) legs were done by using sub-components and smart placement of the component's axes. By making the upper and lower parts sub-components of the leg, I didn't need to worry about their positions - rotating the parent leg rotates both the upper and lower parts together, no matter what their local position/rotation is.

                      Then by placing the lower leg's axis at the top of the component (at the knee), I just had to set it's RotY attribute to make the lower part rotate.

                      PS: Technically, this animation is only a half-stride.

                      You my friend, are my saviour... i`ve been trying to figure this out for the past three days without any success..
                      thank you! thank you so much!

                      1 Reply Last reply Reply Quote 0
                      • jason_marantoJ Offline
                        jason_maranto
                        last edited by

                        Here's a DC clock I made -- I'm sure this has been done to death but it was new to me.
                        DC rotation.skp

                        Best,
                        Jason.

                        I create video tutorial series about several 2D & 3D graphics programs.

                        1 Reply Last reply Reply Quote 0
                        • jason_marantoJ Offline
                          jason_maranto
                          last edited by

                          Here's an animation version of the Clock:DC clock animation.skp

                          Best,
                          Jason.

                          I create video tutorial series about several 2D & 3D graphics programs.

                          1 Reply Last reply Reply Quote 0
                          • yantskiY Offline
                            yantski
                            last edited by

                            I'm not sure if this thread is still catching some action, but...

                            I stumbled onto this technique while looking to solve another problem. I recognized the application immediately as a solve for another problem I was trying to figure out a few days earlier. Funny how that works sometimes!

                            How it works: When clicking on the drawer face (when it's in a cabinet) the whole drawer opens. The second click makes the top tray move back toward the cabinet revealing the bottom tray. Third click, top tray moves forward again. Fourth click, the drawer closes.

                            I'm not sure if the "On Click" code could be simplified and still work the same as I'm quite new to DC syntax.


                            Option_2Tier Cutlery Tray.skp

                            1 Reply Last reply Reply Quote 0
                            • S Offline
                              scottalanclymer
                              last edited by

                              Wow, talk about being late to the party. You guys were messing with dynamic components way before I was even in diapers (SU diapers). 10 years since last post, huh?

                              In all the time you've had since then, has anyone figured out how to have an object move along an arc while maintaining a fixed attitude?

                              Another way to say the same thing would be that it needs to rotate around a fixed point, while not rotating. But I like the first way of saying it better. Any one know how to do this in dynamic components?

                              1 Reply Last reply Reply Quote 0
                              • SJS66S Offline
                                SJS66
                                last edited by

                                Howdy folks. I've made a kitchen sink mixer tap & put an onClick attribute on it that rotates the handles as if turning on the water. The right side handle turns on hot or cold. On is rotate on the Y axis 0 to 15 deg (to right), cold is rotate on X 0 to 30 deg (forward), hot is rotate on X 0 to -30 deg (back or away) say the spout is the front or facing forward.
                                The problem is, they move at the same time, rather then in sequence.
                                How would I get them to move in sequence when onClicked?
                                I tried using a "step" or "set" attribute but couldn't get it to work...above my DC pay grade I'm afraid πŸ˜‰
                                Any suggestions much appreciated.
                                Component Attributes
                                I have a video of the onClick rotations so far but it wouldn't let me attach as a second file!
                                I'll try to upload it as a separate post...is mp4 okay, or doesn't have to be another format?

                                1 Reply Last reply Reply Quote 0
                                • SJS66S Offline
                                  SJS66
                                  last edited by

                                  Wouldn't let my upload my mp4 file showing my onClick rotations so here's a screenshot of the tap at least.
                                  Be nice if you got a prompt or message that it was the wrong file type or something rather than just not working...does it have to be a gif or something? Doh!
                                  Screenshot of the mixer tap.

                                  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