Sketchy Physics is a plugin for Google SketchUp that allows you to simulate mechanical models. It is very capable but also very frustrating so be warned!
I'm working on a design with lots of gears and linkages. SketchUp with Sketchy Physics is up to the task but it is a steep learning curve, with lots of bugs and weird gotchas. Here's some basics that worked for me, to get you started. I'd highly recommend scanning over this tutorial first.
I use the Involute Gears plugin to draw gears in SketchUp.
Using the settings shown, the 2-dimensional gear is placed at the origin as its own group. Double-click to edit the group, and push/pull it to make it 3d.
Sketchy Physics (SP) needs to be told what shape to model your object on. We want to use 'convex hull'.
If you switch on the debug mode 'Readback Collision Geometry', you will see what shape SP is using for your object, when you start your simulation.
To check this, first add a floor, so your gear doesn't go plummeting off the screen.
When you hit 'play', you will see a problem: the black outline is how SP 'sees' your object. The 'convex hull' shape hasn't taken into account the spaces between the teeth.
So we need a better method of telling SP where the teeth are, and where the gaps are. To do this, we need to break the gear up into little pieces. We'll start again from the top, so delete everything.
Draw a gear with the Involute Gear tool, double-click to edit the group, and draw these three lines on the face.
Delete everything apart from these two shapes: let's call it a 'tooth' and a 'spacer'.
You want these to be two distinct components, so its easiest to duplicate them ('M' for move, then 'Ctrl' to make a new copy)
Delete the originals, then push/pull to make the pieces 3D. Then right click on each object and select Make Component
Now make sure that you give each component a 'convex hull' shape.
Now move the two components together and use the rotate tool to duplicate them round about the origin ('Q' for rotate, then 'Ctrl' to make new copy). I found it easier to match the edges perfectly by first making a mark where the tooth should meet the spacer. Precise rotation can be buggy in SketchUp too; you might find it helpful to increase the angular precision in the Model Info tab (in the Window menu).
Continue rotating and copying until you have a complete gear. Make sure all these components are in one group (if you've followed the directions exactly, they will be.)
Now to test that SP sees things the way we do, put a floor back in and set the group's debug mode to 'Readback Collision Geometry', and hit play. You can see that the black outlines now conform to the shape of the gear.
Now to make something happen! We'll add a hinge joint to the center of the gear: click once at the center of the gear, then click again to set the axis of rotation.
First, use the Joint Connector tool to attach the hinge to the floor: select the Joint Connector tool, click the hinge, then hold 'Ctrl' and click on the floor. (If you zoom out you'll see the joint is bordered in yellow and the floor is bordered in green.
Now you connect the Joint to the gear by grouping the two together.
Now when you hit play you should be able to grab and spin the gear around the joint! A gear is not much fun on its own, so duplicate the gear+joint group and place it alongside the original. Joint connections tend to get messed up when you make a copy, so delete the new joint, add immediately add a new one in its place. Reattach it to the floor with the Joint Connector Tool before you regroup the two (gear + joint). Now when you press play, the gears should mesh and turn together.
You can set one of the joints to rotate automatically with the accel (acceleration) and damp (friction) settings in the UI.
And there you have it! Time consuming and frustrating, maybe, but its free and it works!
Getting more complicated
I'll follow up this tutorial with another one next week that will show you how to make more complicated mechanisms with floating joints. In the meantime, if you don't want to wait, check out this tutorial on joints and groups. I've also attached my SketchUp file so you can play along at home.
Update: Here's Part 2 of the tutorial.
Sketchy Physics Gotchas
- Save all the time! My installation at least crashes very frequently.
- Groups of less than a certain volume are ignored, so scale everything up 10x if you're seeing weird behaviour.
- Turn gravity off unless you need it.
- Always attach a hinge to a grouped object (see dummy square hack).
- Put damping on all your hinges