Example #1
0
  public SurfaceMover(Spatial movedNode, Spatial child, Spatial scene, InputManager inputManager) {
    if (scene == null) throw new NullPointerException();

    this.scene = scene;
    // TODO: Clean SphereMotionAllowedListener code
    smal = new SphereMotionAllowedListener(scene, 0.2f);

    inputManager.registerKeyBinding("Left", KeyInput.KEY_J);
    inputManager.registerKeyBinding("Right", KeyInput.KEY_L);
    inputManager.registerKeyBinding("Up", KeyInput.KEY_I);
    inputManager.registerKeyBinding("Down", KeyInput.KEY_K);
    inputManager.registerKeyBinding("PgDn", KeyInput.KEY_PGDN);
    inputManager.registerKeyBinding("PgUp", KeyInput.KEY_PGUP);
    inputManager.registerKeyBinding("Space", KeyInput.KEY_SPACE);
    // used with method onBinding in BindingListener interface
    // in order to add function to keys
    inputManager.addBindingListener(this);

    this.movedNode = movedNode;
    this.normalAligned = child;
  }