I am building a small radar type thing, so I can find where things are. To do this I use:
- I use the CameraNode.
- 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.
- 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.
- 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?
// note: cn = camera node
Quaternion q = new Quaternion(cn.getWorldRotation());
Matrix3f r = new Matrix3f();
Vector3f v = new Vector3f(400,0,0);