Model rotation - noobie

Sorry to bother everyone but I've been having problems with trying to rotate a model to face towards a waypoint that he is moving to. I got sample code to make a model face to a position from this forum http://www.jmonkeyengine.com/jmeforum/index.php?topic=2523.0 . The code im using to rotate the model is as follows


Vector3f direction = new Vector3f(modelPos.subtract(nextWayPoint));
   tmpYaxis.set( direction ).normalizeLocal();
        tmpZaxis.set( new Vector3f(0,1,0) ).crossLocal( direction ).normalizeLocal();
        tmpXaxis.set( direction).crossLocal( tmpZaxis ).normalizeLocal();
        Vector3f [] axes = new Vector3f[3];
      axes[0] = tmpXaxis;
      axes[1] = tmpYaxis;
      axes[2] = tmpZaxis;
          aiModel.getLocalRotation().fromAxes(axes);



The model will constantly turn to the waypoint but the rotation will be off by 90 degrees. The models left side will always face the next waypoint instead off the models front side.  Could anyboday tell me how to subtract 90 degrees from the rotation code above as I don't really know much about vector maths. I have tried other methods to get the model to face a waypoint but in every instance the rotation goes awry, sometimes with colourful results. The closest method to being sucessful is the code above. Any help is much appreciated. Thanks.

First the code you posted does the same like

aiModel.lookAt( nextWayPoint, new Vector( 0, 1, 0 ) );


(you may want to replace it :))

The most performant way would be flipping the axes X and Z and changing sign of x if you need that exact 90

Cheers for the response, sorry I am using the computers at uni and cant install my own software so i havn't got cvs installed and im working off the basic 0.9 build of jme which doesn't have the method Spatial.lookAt(), I'll use the laptop to set up cvs now.

Thanks again for your response, much appreciated.

You can download the nightly builds linked on the main page if you want to stay more up to date.