Model rotation?

Hi i downloaded a nice little cobra car 3ds model and loaded it into my game, however its on its side and facing sideways:



screenshot: http://i41.photobucket.com/albums/e254/frahasio/screeny.png



How do i go about rotating it to be in the right position (i want it to be facing the back of it)

Please consult the beginner's guide, user's guide, and tutorials on the wiki for questions like "how do I rotate stuff".

I tried this but it hasnt done anything:



/* Create an 90-degree-pitch Quaternion. /

Quaternion pitch90 = new Quaternion();

pitch90.fromAngleAxis(FastMath.PI, new Vector3f(0,1,0));

/
Apply the rotation to the object /

player.setLocalRotation(pitch90);

/
Update the model. Now it

You forgot to update the Geometric State!

this is my new code:



/* Create an 180-degree-pitch Quaternion. /

Quaternion pitch90 = new Quaternion();

pitch90.fromAngleAxis(FastMath.PI, new Vector3f(0,1,0));

/
Apply the rotation to the object /

player.setLocalRotation(pitch90);

/
Update the model. Now it

could this be something to do with it?

it in my update method:





        //get the normal of the terrain at our current location. We then apply it to the up vector

        //of the player.

        tb.getSurfaceNormal(player.getLocalTranslation(), normal);

        if(normal != null) {

            player.rotateUpTo(normal);

        }

Hmmm i got one rotation to work but how do i combine 2 different ones?

for example a 270 pitch and then a 180 yaw?



if i do them one after the other, the second time i call setlocaltranslation it will cancel out the first one i did…

:smiley:

Err, that's quite obvious:

You replace one rotation with the other.

How about combining both rotations?

Again, there's a lot of stuff for that in the beginners guide.

Quick answer mult() one of your Quaternions to the other. or multLocal() then apply to the model.

Man, if you tell the end of the book add a spoiler tag  :wink:

The ends always the most interesting part  :smiley: