Understanding ChaseCam

Hey guys,



I am using ChaseCam and there’s something weird happening here. Cam2 and Cam3 take the right two portions of a screen (see below)







and trying to use a chaseCam on those two cams. From what I understood from the wiki is that ChaseCam takes the spatial to follow and the cam and chases it. So my cam originally set for both spatials at a 2d view (0,0,140) - when teh chaseCam is off it’s fine and when the chaseCam is on it goes to a sideway view and very close to the drive (which is expected by the default chasecam.setDistance()). Why is the cam changing its position? I don’t want to give the user the ability of playing around with the track ball so I want it to be already placed in a good angle by default (ideally the 2d cam as it should be)





this is the initial camera setup:

[java]

// setup cam2 location

myApp.cam2x = 0;

myApp.cam2y = 0;

myApp.cam2z = 140;



// setup cam 2 viewport

myApp.view2w = 0.7f;

myApp.view2x = 1.0f;

myApp.view2y = 0.5f;

myApp.view2z = 1.0f;



// setup cam3 location

myApp.cam3x = 0;

myApp.cam3y = 0;

myApp.cam3z = 140;



// setup cam 3 viewport

myApp.view3w = 0.7f;

myApp.view3x = 1.0f;

myApp.view3y = 0.0f;

myApp.view3z = 0.5f;

[/java]



and this is where chaseCam function is declared:

[java]

/**

  • enable/disable ChaseCam: chasecam chases the spatial spatialToFollow
  • that is passed using the passed camera

    */

    private void enableChaseCam(boolean b, Camera cam, Spatial spatialToFollow) {

    if (b == true) {



    // Chasecam properties

    chaseCam = new ChaseCamera(cam, spatialToFollow, inputManager);

    chaseCam.setMaxDistance(1000);

    chaseCam.setMinDistance(2);

    chaseCam.setDefaultDistance(8);

    chaseCam.setChasingSensitivity(1f);

    //chaseCam.setSmoothMotion(true); //automatic following

    //chaseCam.setTrailingEnabled(false);

    }

    }

    [/java]



    and



    [java]

    // Setup second view - upper right

    Camera cam2 = cam.clone();

    cam2.setViewPort(view2w, view2x, view2y, view2z);

    cam2.setLocation(new Vector3f(cam2x, cam2y, cam2z));

    cam2.lookAt(rootNode.getChild(chaseSpatial2).getLocalTranslation(), Vector3f.UNIT_Z);

    ViewPort view2 = renderManager.createMainView("upLright", cam2);

    view2.setBackgroundColor(ColorRGBA.Blue);

    view2.setClearFlags(true, true, true);

    view2.attachScene(rootNode);



    //chaseCam activation for cam2

    enableChaseCam(chaseCam2Active, cam2, rootNode.getChild(chaseSpatial2));



    // Setup third view - bottom right (2D VIEW)





    Camera cam3 = cam.clone();

    cam3.setViewPort(view3w, view3x, view3y, view3z);

    cam3.setLocation(new Vector3f(cam3x, cam3y, cam3z));

    cam3.lookAt(rootNode.getChild(chaseSpatial3).getLocalTranslation(), Vector3f.UNIT_Z);

    ViewPort view3 = renderManager.createMainView("bottom right", cam3);

    view3.setClearFlags(true, true, true);

    view3.setBackgroundColor(ColorRGBA.Blue);

    view3.attachScene(rootNode);



    //chaseCam activation cam3

    enableChaseCam(chaseCam3Active, cam3, rootNode.getChild(chaseSpatial3));

    [/java]



    when they are called