Rotations - what is with the x coordinate?

Hi all,



I am building a small radar type thing, so I can find where things are. To do this I use:

  1. I use the CameraNode.
  2. I get the target node’s position relative to the camera, by subtracting the world position of the camera from the world position of the node.
  3. I rotate it into the local space of the camera, by getting the world rotation of the camera node, converting it to a rotation matrix, taking the transpose of that matrix, and multiplying the vectors out.
  4. I then plot the z,x coordinates on a plane and draw a line of height y at that position.



    The problem I have is that for some strange reason the x coordinate seems to be flipped. or maybe the y coordinate is flipped. I don’t know. it just seems to be in the opposite handedness space.



    have I done something wrong?



    try here:


// note: cn = camera node
            Quaternion q = new Quaternion(cn.getWorldRotation());
            Matrix3f r = new Matrix3f();
            q.toRotationMatrix(r);
            r.transposeLocal();
                       
            Vector3f v = new Vector3f(400,0,0);
            v.subtractLocal(cn.getWorldTranslation());
           
            r.mult(v,v);
            v.normalizeLocal();
            v.multLocal(400f);

System.out.println("["+v.x+","+v.y+","+v.z+"]");

here is a quick screenshot. I am inverting the x coordinate. It works.



[/img]

Looks good… but can you blow those planets up in fiery explosions?? :stuck_out_tongue:



(Sorry, it’s been a weird day.)

ahh… that will be released in a service pack :slight_smile:

Excellent! :slight_smile: