Now that you've completed the Getting Started Kit and have a basic understanding of programming with Phidgets, you can easily integrate sensors into your Unity projects.
This project assumes you have an understanding of Unity and have completed the Getting Started Kit.
For more information, check out the Student Page.
You will need:
- A Getting Started Kit
Connect your Getting Started Kit to your computer.
In order to use Phidgets with Unity, you will need a copy of Phidget22.NET.dll. You can find different versions here in the Phidget22 Windows Development package.
The different versions are organized by date. Try to select the version that matches the libraries installed on your computer.
Find the folder you just downloaded and navigate to /phidget22-windevel/lib/dotnet/net46 and import Phidget22.NET.dll:
You've now successfully added the libraries to your project. The next step is creating your environment.
Note: if you are using an older version of Unity, check here for information on how to add the libraries.
The first step is to open your BallScript file and add a reference to Phidget22.
Next, create a DigitalInput object for your button, as well as a Rigidbody component for your sphere.
Add a StateChange event for your button like you've done in previous projects. Also add a boolean called buttonState to track whether the button has been pressed or not.
Try running your program. You should see your sphere jump when the button is pushed.