Initializing the User's ViewpointWrapShooter3D calls initUserControls( ) to configure the viewpoint. The method carries out four main tasks:
The initUserControls( ) method is: private void initUserControls(Vector3d targetVec) { // add a 'gun in hand' image to the viewpoint ViewingPlatform vp = su.getViewingPlatform( ); PlatformGeometry pg = gunHand( ); vp.setPlatformGeometry(pg); // position starting viewpoint TransformGroup steerTG = vp.getViewPlatformTransform( ); Transform3D t3d = new Transform3D( ); steerTG.getTransform( t3d ); t3d.setTranslation( new Vector3d(0, 1, Z_START) ); steerTG.setTransform(t3d); // create ammo (beams and explosions) AmmoManager ammoMan = new AmmoManager(steerTG, sceneBG, targetVec); // set up keyboard controls KeyBehavior keyBeh = new KeyBehavior( ammoMan ); // keyBeh can ask the ammoManager to fire a beam keyBeh.setSchedulingBounds(bounds); vp.setViewPlatformBehavior(keyBeh); } // end of initUserControls( ) |