Contents

Chapters

Sections

j3d.org

[ Previous ] [ Up ] [ Next Chapter ]

Standard Sensors

© Justin Couch 2000

One of the more typical uses of sensors are to drive the user's view position or a pointer equivalent. To cater for these situations, Java 3D has a set of standard sensor inputs that you may use to automate some of the control. In doing so, it removes some of your code work and allows for some optimisations on the rendering side.

Java 3D provides three standard sensor inputs called: UserHead, Dominant hand, Non-Dominant hand. UserHead represents the head tracking scenario. Dominant hand represents the pointer used most often for control of objects like wands, gloves and various other pointers. Non dominant hand represents the other hand and the two hands may be swapped to accommodate left and right-handers. The idea of these standard sensors is to provide a socket to place any given sensor and allow it to control your interactions with the scene graph. In the previous section you manually moved the view point on each frame and these eliminate the need to write that code.

UserHead is usually the most interesting because it allows you to use head tracking type systems to automatically track where you are looking without needing a mouse to control the scene. If we were constructing a Formula 1 application we could model one sensor for each car, say facing forward. To model the view from a particular car we set the sensor corresponding to that car as the head tracker and enable head tracking in the PhysicalEnvironment. Now, wherever the car moves and orientates, we move the viewpoint with it. No work, and we have instant car-cam enabled in the application.