Advanced Tutorial - Engine Hoist
- 1 Project goal
- 2 Project overview
- 3 Step 1. Create a Kinematics Controller
- 4 Step 2 - Add a Wheel Joint to the Arm
- 5 Step 3 - Add a Wheel Joint to the Piston Tube
- 6 Step 4 - Add a Bar Linkage Solver to the Piston Rod and create a Triangle with both Wheel Joints
- 7 Step 5 - Create a Spline for the Bar Linkage Solver.
- 8 Step 6 - Add a Gyroscopic Joint to the Hook to have it pointed downwards at all times
To get started, first download the Tutorial Project
This is what you will learn to make in this tutorial
Project goal
The goal of this advanced tutorial is to teach you how to rig an engine hoist with a kinematic setup.
You will need to:
Create a Kinematic Controller.
Add a Wheel Joint to the Arm.
Add a Wheel Joint to the Piston Tube.
Add a Bar Linkage Solver to the Piston Rod and create a Triangle with both Wheel Joints.
Create a Spline for the Bar Linkage Solver.
Add a Gyroscopic Joint to the Hook to have it pointed downwards at all times.
Project overview
The project consists of a predesigned model that has been optimized and correctly put into the Hierarchy. Textual reference has been added to each of the steps, please find these under the Engine Hoist Tutorial. The textual reference is displayed in the Inspector.
You can find the correct scene in the Tutorial Project under
Assets > 2 - Advanced Tutorials > 2 - Engine Hoist Tutorial > 1 - Exercise - Engine Hoist Tutorial
3d-model of the engine hoist (supplied with the tutorial)
Hierarchy setup (supplied with the tutorial)
For reference, the finished setup has also been provided. Open the scene: 2 - Finished - Engine Hoist Tutorial under Assets > 2 - Advanced Tutorials > 2 - Engine Hoist Tutorial
Step 1. Create a Kinematics Controller
If you want to use Kinematics, you will firstly need a Kinematics Controller . This component controls all Kinematic Transforms in the scene.
To create a Kinematics Controller, go to Mechanics > Add Kinematics > Kinematics Controller.
The Kinematics Controller will be assigned to a selected GameObject, or when there is no GameObject selected, a new one will be automatically created.
For now, deselect everything and add a Kinematics Controller.
Make sure to place the Kinematic Controller above the parts you want to control, in this case the Engine Hoist. Drag the Engine Hoist onto the NEW_KINEMATICSCONTROLLER.
Step 2 - Add a Wheel Joint to the Arm
To create a Wheel Joint and assign it to a GameObject, select the GameObject and go to Mechanics > Add Kinematics > Wheel Joint.
This will create a Wheel Joint attached to the Arm. Make sure your Gizmos are turned on, so will you see the newly created Wheel Joint. To turn on Gizmos, go to the top-right of the Scene View, and press Gizmos.
The Wheel Joint is created with a standard radius of 1 unit, we will change this to 0.3. Select the Arm and got to the Inspector. Under Wheel Joint, change Wheel Radius to 0.3
Step 3 - Add a Wheel Joint to the Piston Tube
Select the Piston Tube and under Mechanics > Add Kinematics create a Wheel Joint attached to the Piston Tube. Change the Wheel Radius to 0.3.
Step 4 - Add a Bar Linkage Solver to the Piston Rod and create a Triangle with both Wheel Joints
To create a Bar Linkage Solver, select the GameObject you want to assign it to and go to Mechanics > Add Kinematics > Bar Linkage Solver.
Select the Piston Rod and add a Bar Linkage Solver.
Select the Piston Rod and go to the Inspector. Under Bar Linkage Solver, you will find the Add Triangle button. Add a Triangle.
Under Fix Pivot, select the Piston Tube. The Fix Pivot is the pivot that connects the base Triangle leg to the dynamic Triangle leg, in this case the Piston Tube.
Under Hinge Point select the Arm. The Hinge Point is the pivot that connects the base triangle leg to the fixed rotating Triangle leg, in this case the Arm.
The Triangle is now setup correctly, but we need a Spline connected to the Piston Rod to constrain its movement in our scene.
Step 5 - Create a Spline for the Bar Linkage Solver.
To create a SplineUNDEFINED , deselect everything and create a new Spline under Utilities > Create > Spline.
Parent the Spline under the PistonTube so that is has the same parent as the PistonRod.
The NEW_SPLINE will be created with two control Points.
This Spline will control the range of motion the Piston Rod will have. We need to align both Points to the Piston Rod.
To get a better look at your objects, hide everything in your scene except the NEW_SPLINE and the Piston Rod. Click on the Eye-icons to the left of the Hierarchy Window to hide or unhide objects.
We need the Spline to be the exact length of the Piston Rod.
To get a better look, switch to Isometric Mode in the Scene View and position your view looking straight at the Piston Rod.
To align a Point to the Piston Rod, drag it to the right position. Hold down V to snap to vertices and position the point perfectly.
Turn on Shaded Wireframe to get a better look.
Position Point 2 at the top of the Piston Rod.
Position the NEW_SPLINE so that it represents the range of motion of the Piston Rod.
Unhide all objects in the scene.
Select the Piston Rod and under Limit Relations & Update Settings, choose the NEW_SPLINE.
Select the Arm and enable Enforce Outside Playmode on the Wheel Joint
Select the Piston Tube and enable Enforce Outside Playmode on the Wheel Joint
Select the Piston Rod and enable Enforce Outside Playmode on the Bar Linkage Solver
Moving the Piston Rod now moves the complete system through the Bar Linkage Solver.
Step 6 - Add a Gyroscopic Joint to the Hook to have it pointed downwards at all times
The Hook will follow the movement of its parent, in this case the Arm. To have the Hook always pointed downwards, we can add a Gyroscopic Joint .
Select the Hook and go to Mechanics > Add Kinematics > Gyroscopic Joint
Go to the Gyroscopic Joint in the Inspector and under Global Up Direction change the Vector to Up.
Make sure to enable Enforce Outside Playmode.
The Hook will now always face downwards, no longer following the rotation of its parent.
The end result should look like this:
Prespective Documentation