sketchucation logo sketchucation
    • Login
    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!
    🛣️ Road Profile Builder | Generate roads, curbs and pavements easily Download

    SP3 Useful controller scripts

    Scheduled Pinned Locked Moved SketchyPhysics
    15 Posts 7 Posters 2.4k Views 7 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

      I fixed the spaces bug in the next version. Without spaces it looks like this:

      if(frame<30);0.0;else;1.0;end

      You can also combine sliders
      ((0.5-righty)*slider("MaxSpeed"))-slider("Trim")

      Also sliders can take be configured:

      slider("Zero",0) <--Slider has a default position of 0 instead of 0.5
      slider("Ten",10,0,10) <--Slider goes from 0-10 and has a default position of 10

      There is a bug and sliders don't initial show the correct position. Quickly click it to make it update.

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

        wow thanks!

        1 Reply Last reply Reply Quote 0
        • W Offline
          Wacov
          last edited by

          I need a script for a motor using the triggers (joyRY) and the a button. When the right trigger is pressed (<0.5 for me) the motor should spin, and if a is pressed with the right trigger, it should spin at twice the speed. At 0.5, the motor should be allowed to spin freely (if possible) and a should have no effect. Above 0.5 (left trigger) the motor should stop spinning completely for 2 seconds, then go into reverse at half the normal speed, again with a having no effect.

          I hope this isn't too complicated 😄

          This is for a car with 'boost' that can brake and reverse using the same button.

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

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

            @cphillips said:

            slider("Zero",0) <--Slider has a default position of 0 instead of 0.5
            .

            How do I make the keyboard keys start at default position of Zero
            or can't I?
            like what I want is to not be able go backwards with a motor but start at zero

            Tableau de comparaison de Staxyn s'agit d'un mГ©dicament uniquement sur ordonnance.

            1 Reply Last reply Reply Quote 0
            • C Offline
              CPhillips
              last edited by

              rightx-0.5
              

              For keyboard right/left

              1 Reply Last reply Reply Quote 0
              • B Offline
                BTM
                last edited by

                Any chance a guide or tutorial will be made to explain how to use these codes? It doesn't seem like something you could just pick up and figure out in a few minutes. Oh, and what do you type in the box to duplicate the object connected to the joint, like in the preview video?

                Oh, and to make thrusters/magnets controllable:

                (0.5-righty)*100000

                0.5-: not necessary, but allows reverse directions. 0.8- would make it go 80%forward, 0.5- makes it half and half, so neutral means no thrust, and 0.2- would make it go 20% forwards.

                right: right or left, which joystick to use/ wasd or arrow keys.

                y: x or y, left and right, or up and down.

                *100000: a *, and the strength of the thruster/magnet.

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

                  Will the beta version have the copy function?

                  1 Reply Last reply Reply Quote 0
                  • C Offline
                    CPhillips
                    last edited by

                    I just figured out how to make the copy function work. Its now called Emitters and it will be in next version.

                    1 Reply Last reply Reply Quote 0
                    • B Offline
                      BTM
                      last edited by

                      do you know what controller scripts are used to make a keyboard key do an action
                      (like the spacebar, or letters other than WAS and D),
                      or for a slider to multiply an object like in the pre-release video?

                      Also, do you know why the script

                      (lefty-0.5)*300+slider('hover')*150
                      

                      won't work in a thruster controller box? without the '-0.5', it seems to work, but I can't get it to do what I'm trying to.

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

                        @unknownuser said:

                        do you know what controller scripts are used to make a keyboard key do an action
                        (like the spacebar, or letters other than WAS and D),
                        or for a slider to multiply an object like in the pre-release video?

                        Also, do you know why the script

                        (lefty-0.5)*300+slider('hover')*150
                        

                        won't work in a thruster controller box? without the '-0.5', it seems to work, but I can't get it to do what I'm trying to.

                        that worked fine for me though the controls were switched so I did this

                        -(lefty-0.5)*300+slider('hover')*150
                        

                        Tableau de comparaison de Staxyn s'agit d'un mГ©dicament uniquement sur ordonnance.

                        1 Reply Last reply Reply Quote 0
                        • N Offline
                          nosam55
                          last edited by

                          how do you make a motor controled by the arrow keys and have reverse?

                          1 Reply Last reply Reply Quote 0
                          • B Offline
                            BTM
                            last edited by

                            righty-0.5

                            righty-0.5

                            right: controlled by right joystick, or keyboard arrow keys. left would be left joystick, or WASD keys.

                            y: y= up and down. x=left and right.

                            -0.5: makes .5 of the speed going backwards, in other words, allows reverse. you could also put 0.5- before righty, if the motor is going in the wrong direction.

                            Oh, and Phy, thanks; but for me, only half the controls were reversed: I managed to fix it after though.

                            1 Reply Last reply Reply Quote 0
                            • N Offline
                              nosam55
                              last edited by

                              Thanks 😄

                              1 Reply Last reply Reply Quote 0
                              • C Offline
                                CPhillips
                                last edited by

                                @unknownuser said:

                                do you know what controller scripts are used to make a keyboard key do an action
                                (like the spacebar, or letters other than WAS and D),
                                or for a slider to multiply an object like in the pre-release video?

                                Also, do you know why the script

                                (lefty-0.5)*300+slider('hover')*150
                                

                                won't work in a thruster controller box? without the '-0.5', it seems to work, but I can't get it to do what I'm trying to.

                                Not yet. But I think I am going to add something like

                                key("space") or key("1")

                                Mulitply an object will be the new emitters.

                                Your script should work as far as I can tell.

                                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