3D to 2D Rotation

Hey Guys, me again!

I am currently making a 2d mini-map for my HUD. The HUD itself uses the ORTHO system, and I've been having a few problems with some of the conversions between the 2d and 3d spaces.

To position given nodes on the mini-map I am using their local translation (subtracted from the player node). This, obviously, puts the player at the center of the map (at distance 0,0,0 from itself) and the other nodes move around this point. Super! Exactly what I wanted!

To do this I am having to do the following (put the z -> y, and clear z):

//Get new position
   Vector3f newPosition = new Vector3f(

I understand that this is something to do with the way that the 3D is flattened into the 2D ORTHO thingy.

My question is... how do I deal with a quaternion / rotation?

Basically, I want to represent enemies with a triangle, with the tip of the triangle facing the same direction that the model is. I can access the model's local rotation, but I have no idea how to use it (or what the "w" element is).

Any help would be muchous apreciated!!

Quaternions have a few helpful methods which abstract their complex mechanics… Try using Quaternion.fromAngles(), with the angle of rotation being in the 3rd argument (Z-axis).

Thanks for your help, but I'm not sure I am following you fully. What I have tried so far is…

Quaternion a = new Quaternion(currentBlip.getTarget().getModel().getLocalRotation());

But that's just been a guess. It doesn't seem to work properly, they all face the same direction and it does not rotate when they do!


Also tried…

Quaternion a = new Quaternion();
a.fromAngles(0, 0, currentBlip.getTarget().getModel().getLocalRotation().z);

Doesn't work either!

currentBlip.getTarget().getModel().getLocalRotation().z is not an angle.

I think that needs some explaining:

currentBlip - The Node on the HUD

currentBlip.getTarget() - The Node that the blip is representing (located on the terrain)

currentBlip.getTarget().getModel() - The model loaded from an external file

That make any more sense?

If you want a node to have the same rotation as  another, then why don't you just set the local rotation of one to that of the other?

Because I'm using the ORTHO system, meaning that the coordinate systems do not match up with the 3D space (on the terrain).

Ok… I think I get it now. You need to get the model's facing angle in world space and then provide it as input as the Z-axis angle.