The P5 Virtual Reality Glove is a low-price data glove suitable for gaming and 3D virtual environments.
The user moves their hand in front of a receptor 'tower' (shown on the right), which contains two infrared sensors. They detect the visible LEDs on the glove (there's eight altogether), and convert them into an (x, y, z) position for the glove, and an orientation in terms of pitch, yaw, and roll.
The glove is plugged into the tower, which is connected to the PC's USB port.
The glove also has bend sensors in its fingers, and four buttons on the top.
I'll explain how to communicate with the P5 glove using Java, and implement a Glove class that hides most of the interfacing details.
However, the chapter's main focus is on developing a Java 3D application called HandView3D, a variant of ObjView3D from chapter 7. This time the camera moves forwards, backwards, and turns left or right based only on glove movements; no key presses are necessary.
A musical cow is standing in the middle of the scene (visible in right hand picture). As the user approaches or retreats, the music's intensity varies, as does the mix of sound coming from the speakers. The spatial effects are managed by my JOAL sound manager class from the last chapter. Perhaps mercifully, the music can be paused by the user clenching their fist or pressing a button on the glove. Another fist-clench, or button press, resumes the audio accompanyment.
One advantage of using the P5 is that several operations can be carried out at once; for example, a user can move the camera forwards and left at the same time. This is possible because the P5's data is accessed using polling.