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

    Component rotation clockwise and counter clockwise

    Scheduled Pinned Locked Moved Dynamic Components
    sketchup
    9 Posts 2 Posters 2.2k Views 2 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.
    • D Offline
      DedongC
      last edited by

      I have a dynamic component set up to rotate like this when clicked:
      ANIMATESLOW("RotY",360,0)
      It rotates clockwise 360 degrees perfectly, but when clicked to return to 0 degree, it still rotates clockwise instead of counter-clockwise, no matter what degree I set for the second parameter. How can I get it rotate counter-clockwise after it rotated by the first parameter.
      Any help for this?

      Attached is my sketchUp dynamic component file.

      DedongC


      my dynamic component file.

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

        Try this:


        my rotation test V2.skp

        1 Reply Last reply Reply Quote 0
        • D Offline
          DedongC
          last edited by

          prokrastintor,
          Thank you so much for your smart solution! and now I can use your formula to do any degrees(by changing the parameter 360),though I am not able to fully understand the code. You are great!
          Just wonder if you can do me another favor? how can you make it turn forever in one direction like a real tire until click again to stop it?

          Thanks again! This is a good site to seek solutions.

          Dedong

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

            At first glance, I can't work out how to have the component spin infinitely until clicked again. My suggestion (based on your comment about a real tire) would be to investigate the SketchyPhysics plugin. There are a few small issues with it running with other plugins but overall it is a very useful tool. Note however, it will take some getting used to.

            1 Reply Last reply Reply Quote 0
            • D Offline
              DedongC
              last edited by

              prokrastinator,
              Thanks very much for your suggestion, I am going to learn how to use that plugin.
              I just started learning the DC,Can you please explain a little bit about the formula that you used for the rotation? what the IF statement means to make the tire rotate and then reverse direction?
              count_up_down =if(counter<=100, counter, 200-counter)

              Thanks in advance!

              DedongC

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

                There are two values changing here, the 'counter' and the 'count_up_down'.

                The 'counter' is controlled by the animatecustom command. It goes from 0 to 100 on the first click, then up to 200 on the next click, then back down to 100 and then back down to the starting 0.

                An IF statement is written like this: =if(test, true answer, false answer)

                If the 'counter' is between 0 and 100 (in other words less than or equal to 100), then the 'count_up_down' value copies (equals) the 'counter' value .

                example: if the 'counter' is 10 then the 'count_up_down' is 10.

                The 'count_up_down' value = 200 minus the 'counter' value if the 'counter' is between 101 and 200.

                example: if the 'counter' is 145 then the 'count_up_down' is 200-145 = 55.

                You can then use the 'count_up_down' value to drive the rotation.

                1 Reply Last reply Reply Quote 0
                • D Offline
                  DedongC
                  last edited by

                  Thanks very much for your explanation!
                  I modified the formula a little bit and can get it to turn in any circles and reverse by setting up two attributes(counter and timer). Attached is my modified DC model.

                  DedongC


                  my rotation test V6.skp

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

                    Nice work. This is definitely a better way of tackling your original question. I'm still not sure how you can achieve your second request of continuous motion until clicked again though.

                    1 Reply Last reply Reply Quote 0
                    • D Offline
                      DedongC
                      last edited by

                      Thanks very much!
                      As I have just started learning how to do DC, I just posted another model in a new thread to seek solution.
                      http://sketchucation.com/forums/viewtopic.php?f=289&t=48529
                      Please take a look to see if you have any idea.

                      DedongC

                      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