Problems with ThirdPersonHandler+ChaseCamera

hi together,

im using a thirdperson handler and a chase camera. the chase camera is updated like this:

      float camMinHeight = 2f;
        if (!Float.isInfinite(camMinHeight) && !Float.isNaN(camMinHeight)
                && cam.getLocation().y <= camMinHeight) {
            cam.getLocation().y = camMinHeight;

        float characterMinHeight = 2f;
        if (!Float.isInfinite(characterMinHeight) && !Float.isNaN(characterMinHeight)) {
            m_character.getLocalTranslation().y = characterMinHeight;

the third person handler is setuped like this:

HashMap<String, Object> handlerProps = new HashMap<String, Object>();
        handlerProps.put(ThirdPersonHandler.PROP_DOGRADUAL, "true");
        handlerProps.put(ThirdPersonHandler.PROP_TURNSPEED, ""+(1.0f * FastMath.PI));
        handlerProps.put(ThirdPersonHandler.PROP_LOCKBACKWARDS, "false");
        handlerProps.put(ThirdPersonHandler.PROP_CAMERAALIGNEDMOVE, "true");
        input = new ThirdPersonHandler(m_character, cam, handlerProps);

and the chase camera is like this:

Vector3f targetOffset = new Vector3f();
        targetOffset.y = (((BoundingBox) m_character.getWorldBound()).yExtent+10) * 1.5f;
        targetOffset.x = (((BoundingBox) m_character.getWorldBound()).xExtent+10) * 1.5f;
        targetOffset.z = (((BoundingBox) m_character.getWorldBound()).zExtent+10) * 1.5f;
        chaser = new ChaseCamera(cam, m_character);

now my problem is, that the camera doesn't zooms far out. it only zooms a little bit out. where and how can i define how far the camera should zoom out? zoom in is no problem but zooming out doesnt works far engouh.

then the second problem is... i can move the camera with the mouse. but its not possible to move the camera in this way that the camera is really perpendicular to the ground respectivley the node the chase camera is following.

does anybody know how and where to solve this?

thx sebastian


there are some other props to set:

props.put(ThirdPersonMouseLook.PROP_MAXROLLOUT, "8");
      props.put(ThirdPersonMouseLook.PROP_MINROLLOUT, "3f");
      props.put(ThirdPersonMouseLook.PROP_MOUSEROLLMULT, "0.75f");
      props.put(ThirdPersonMouseLook.PROP_MOUSEXMULT, "0.5f");
      props.put(ThirdPersonMouseLook.PROP_MOUSEYMULT, "1.0f");

and the Chasecam has two methods as well:

m_chaseCam = new ChaseCamera(getPlayerNode, props);

thx. i tried different values but can't really fix the problem. unfortunately the api isnt really helpful

is setMaxDistance corresponding to PROP_MAXROLLOUT`? or ar the totally independet? and what mins MOUSEXMULT or MOUSEROLLMULT?

You don't really need the HashMap, the ChaseCamera class has functions to edit most of the properties.

anymay if i use hashmap or method calls, i can't solfve the problem because i dont know what the methods or fields mean :wink:

you can use jmetest.input.RenControlEditor to try out different ChaseCamera settings.

well the names are quite selfdescribing, arent they?

Min/MaxRollout means the maximum allowed distance between cam and target (corresponding to setMaxDistance())

MouseRollMultiplier is the factor by how much the cam moves away/towards the target as the mousewheel turns.

Mouse x/y-multiplier means the sensitivity on the mouseaxis… so how fast the cam moves around the target.

the values for the maxRollout is depending on the scale of ur scene…

(sry my (kind of) bad english)

you can use jmetest.input.RenControlEditor to try out different ChaseCamera settings.

good to know ;)
haven't known this before.

i tried a lot with this methods like MAXROLLOUT or camera set mindistance. but nothing worked. any other propositions?

just take a look at the mentioned RensControllEditor… It generates code ( from ajustable parameters) which you just can copy.