Chase camera wont follow behind model

Ive been trying to get my chase camera to always be directly behind my model but it ends up directly right of model.

also I want non arc strafing, I want strafe to be perpendicular to dir model is facing. I tried a ThirdPersonHandler but had no luck and the model would only strafe when moving forward.

thanks in advance for reply.

private void buildChaseCamera() {
        HashMap props = new HashMap();
        props.put(ThirdPersonMouseLook.PROP_ROTATETARGET, "true");
        props.put(ThirdPersonMouseLook.PROP_MAXROLLOUT, "6");
        props.put(ThirdPersonMouseLook.PROP_MINROLLOUT, "3");
        props.put(ThirdPersonMouseLook.PROP_MAXASCENT, ""+45 * FastMath.DEG_TO_RAD);
        props.put(ChaseCamera.PROP_INITIALSPHERECOORDS, new Vector3f(5, 0, 30 * FastMath.DEG_TO_RAD));
        props.put(ChaseCamera.PROP_DAMPINGK, "4");
        props.put(ChaseCamera.PROP_SPRINGK, "0");//controls camera sway on movment
        props.put(ChaseCamera.PROP_STAYBEHINDTARGET, "true");
        chaser = new ChaseCamera(cam, robot1, props);

private void buildInput() {
    input = new robotMotionHandler(robot1, properties.getRenderer());

robotMotionHandler is FlagRushHandler I only changed right/left rotates to right/left strafes
KeyNodeStrafeRightAction strafeRight = new KeyNodeStrafeRightAction(node, 10f);
        addAction(strafeRight, "strafeRight", true);
        KeyNodeStrafeLeftAction strafeLeft = new KeyNodeStrafeLeftAction(node, 10f);
        addAction(strafeLeft, "strafeLeft", true);

Im going for quake3 movement but thirdperson .
edit: ok I got it mostly working with ThirdPersonHandler but the strafe is still a huge arc.
and if I change it to strafe properly I cant rotate with the mouse at all. :?

Have you solved the problem?

I have it too.

the camera behind model problem? or the arc-strafing?


no the arc strafing remains even when I get the camera to stay behind model.I have no idea how to fix it I was waiting for the developers to get to it or someone in the forums post a fix. as for getting the camera to stay behind model, I use these properties for my chaser cam.

props.put(ThirdPersonMouseLook.PROP_ROTATETARGET, "true");
props.put(ThirdPersonMouseLook.PROP_LOCKASCENT, "true");
props.put(ChaseCamera.PROP_INITIALSPHERECOORDS, new Vector3f(5, 0, 10 * FastMath.DEG_TO_RAD));
props.put(ChaseCamera.PROP_ENABLESPRING, "false");

and these in third person handler.

           * When true, the controlled target will do turns by moving forward and
           * turning at the same time. When false, a turn will cause immediate
           * rotation to the given angle.
           handlerProps.put(ThirdPersonHandler.PROP_DOGRADUAL, "true");
          handlerProps.put(ThirdPersonHandler.PROP_TURNSPEED, ""+(1.0f * FastMath.PI));
            * if true, backwards movement will not cause the target to rotate around to
            * point backwards. (useful for vehicle movement) Default is false.
           handlerProps.put(ThirdPersonHandler.PROP_LOCKBACKWARDS, "true");
            * if true, strafe movements will always be target aligned, even if other
            * movement is camera aligned.  Default is false.
           handlerProps.put(ThirdPersonHandler.PROP_STRAFETARGETALIGN, "false");
            * if true, movements of the character are in relation to the current camera
            * view. If false, they are in relation to the current target's facing
            * vector. Default is true.
           handlerProps.put(ThirdPersonHandler.PROP_CAMERAALIGNEDMOVE, "false");
            * if true, left and right keys will rotate the target instead of moving them.
            * Default is false.
           handlerProps.put(ThirdPersonHandler.PROP_ROTATEONLY, "false");
           handlerProps.put(ThirdPersonHandler.PROP_KEY_FORWARD, ""+KeyInput.KEY_W);
           handlerProps.put(ThirdPersonHandler.PROP_KEY_LEFT, ""+KeyInput.KEY_Q);
           handlerProps.put(ThirdPersonHandler.PROP_KEY_BACKWARD, ""+KeyInput.KEY_S);
           handlerProps.put(ThirdPersonHandler.PROP_KEY_RIGHT, ""+KeyInput.KEY_E);
           handlerProps.put(ThirdPersonHandler.PROP_KEY_STRAFELEFT, ""+KeyInput.KEY_A);
           handlerProps.put(ThirdPersonHandler.PROP_KEY_STRAFERIGHT, ""+KeyInput.KEY_D);

its the best I could get for now.if you figure out a fix for the arc-strafing let me know.

Ok, i got a solution.

I took the old version of the ThirdPersonCamera and edited it, so that it works with the new jME.

It works WITHOUT the ChaseCamera.

Here are the 3 classes:

To use it you have to init the CrazyHandler with the playernode/targetnode:

Input input = new CrazyHandler(player, 10f);

Mousewheel for zoom is not working but the camera stays behind the player and there is no arc-strafing. :wink:

UPDATE: I updated CrazyHandler and SphericalMouseLook. MouseWheel is working now.

NICE. 8)

This piece of code was very helpful.