/
Basic Tutorial - Revolution Counter

Basic Tutorial - Revolution Counter



To get started, first download the Tutorial Project


Project goal

The goal of this tutorial is to teach you how to create a Revolution Counter by rigging a DC motor to rotate a flywheel with a hole. A Beam Receiver triggers a counter script when it detects a beam, from the Beam Emitter, passing through the hole.

You will need to:

  1. Create a Kinematics Controller.

  2. Add a WheelJoint to the Axis object.

  3. Add a DCMotor to the Motor object.

  4. Add a BeamEmitter to the Emitter Lens object.

  5. Add a BeamReceiver to the Receiver Eye object.

  6. Have the BeamReceiver execute an action when the laser is detected.


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 Revolution Counter Tutorial. The textual reference is displayed in the Inspector.

You can find the tutorial scene in the Tutorial Project under
Assets > 1 - Basic Tutorials > 2 - Revolution Counter Tutorial > 1 - Exercise - Revolution Counter Tutorial

3d-model of the Revolution Counter (supplied with the tutorial)

Hierarchy setup (supplied with the tutorial)


For reference, the finished setup has also been provided. Open the scene: 2 - Finished - Revolution Counter Tutorial under Assets > 1 - Basic Tutorials > 2 - Revolution Counter Tutorial > 1 - Exercise - Revolution Counter Tutorial


Step 1. Create a Kinematics Controller

If you want to use Kinematics, you will firstly need a V2020.1.56.3_ 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 parent the Kinematic Controller above the parts you want to control, in this case the Revolution Counter. Drag the Revolution Counter onto the NEW_KINEMATICSCONTROLLER.


Step 2. Add a Wheel Joint to the Axis object

To create a https://unit040.atlassian.net/wiki/spaces/PUD/pages/281673729 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 Axis. 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 Direction and Radius of the Wheel Joint are not correct, we will change the