5) Using the UI for Advanced Jointing
Now that we have the basics of using SP down, let's move on to some of the more advanced features available.
One of the first things you notice after installing SP is the Sketchyphysics Inspector window (otherwise known as the UI) that pops up whenever you start SU.
UI contains information and adjustable settings related to the object
selected in your model. Anytime you select an object in your model,
this window shows the general properties of that object. This is
particularly useful when checking joint properties.
Let's take a look at the bottom of the UI first. You'll see there are a series of check-boxes under the STATE header:
One important difference is the showcollision check box. This is similiar to the "debug" command when right-clicking, except instead of drawing a wire-mesh only in the initial position of the object, the wire mesh is visible throughout the objects movement. Now you can see when and how objects collide, not just how they look when they start.
Further up in the UI, you will see numerous settings for joints such as: min, max, accel, damp and controller. Select a joint first, and then use these settings to add further control to your selected joint.
Note that these options depend on what type of a joint is selected. Some, all, or none of these options may be available depending on the joint type.
To see how powerful the UI can
be, lets start with a simple Hinge joint and see what kind of
modifications we can do to it through the UI. Through the UI, we can make a simple hinge behave like a servo, or even a customized motor with forward and reverse capabilities!
So lets begin by creating a simple model with a hinge in it for an example. Below is a windmill with a single hinge that we'll use as the main controllable object.
(The hinge is grouped to the blade and joint-connected to the base.)
Now select the hinge and look at the UI window.
The first settings you see are the Min and Max settings. These can set the range of movement for the Hinge. In a normal hinge, these settings are both at zero, and so the hinge spins in a 360 degree circle, like on a wheel.If we change the min and max to -90 and 90, this will limit the swing to 90 degrees in either direction of the start point. (This would be useful in a door where you don't want it to swing past the normal extents.) For now, we'll leave these at the default settings so our windmill can spin 360 degrees.
The next thing we'll look at is the "controller" box. This can be looked at as a way to "name" a joint.
For a hinge this is blank by default. The reason it is blank is because normally a hinge does not need any control.
Whenever we run a Sketchyphysics animation, a control panel pops up. This control panel contains all the "named" joints in the animation.
If we ran the animation now, the control panel would be blank. This is because our hinge has no "controller" value yet.
Once we "name" the hinge, it will show up in the "control panel" when we press RUN. So let's name our hinge "MAIN" in the UI and run the animation.
Now the named hinge "main" will now show up in our control panel when we run the animation:
Since we named our hinge, and gave it control through the control panel, it will no longer behave like a hinge spinning freely. Instead it will now be a controllable joint like a servo. As you move the slider left or right, the hinge will move in that direction, but it will no longer spin freely. In essence we have created a servo from a hinge simply by naming it in the UI.
Now lets go back to the other settings in the UI and see what else we can do with this hinge.
Next we'll look at the accel option. This relates to the automatic speed of the joints movement. On a hinge this is normally zero, and the hinge does not spin unless something makes it move. If we set an accel value, the hinge will spin on its own and behave more like a motor.
One important difference is that the hinge can spin in either direction, where a motor can only spin in the direction it is originally placed.
Let's set the accel value to 1 and see what happens when we press RUN.
If you did not name the hinge by setting a value in the controller box, the hinge will spin in one direction just like a motor.
If you did name the hinge in the "controller" box, you'll see the control panel pop up with the name of the hinge:
By default, the slider bar is at 0.5 (or at rest). By sliding it either left or right, we can make the hinge spin in either direction. The further you slide it, the faster it will spin in that direction.
NOTE: This is just an example of using the UI, and the hinge is more of a hybrid than a true motor. If you move the slider halfway in either direction, the hinge will try to act somewhat like a servo and somewhat like a motor. When the slider is fully left or right, it will act like a true motor. When precision is needed, use the appropriate joint for the job. (A motor or a servo.)
Another interesting thing we can do when setting the controller value is to set multiple joints to the same controller name. By doing this, you can control many joints at once with one slider. We'll see an example of this on the next page when we add steering to our original car model.
But before we get to that, lets look at the final option in our UI: the damp setting. You can use this to smooth out "twitchy" joints and make them run more smoothly. Play around with different settings in the above model and see how it affects the model.
Remember, each joint type has it's own settings in the UI, and the only way to know how any setting will affect that joint is to plug in some values and test it out.
Now that we have the basics of using the UI down, let's continue on with learning the UI and add some steering and forward/ reverse control to our original car model.