LWJGL Forum

Programming => Lightweight Java Gaming Library => Topic started by: Exempt on March 01, 2015, 15:20:41

Title: Solved. Getting translation from Matrix4f
Post by: Exempt on March 01, 2015, 15:20:41
Edit: Nvm, this because I think the issue is a deeper one then this question can answer. sorry.

I'm using the 2.9.3 LWJGL. I'm trying to draw lines between joints in my skeletal animation data so I figured I could just get m.30, m.31 and m.32 for x, y and z but the results aren't what I'd expect.

The red cubes are placed using the joint matrices which are in the right positions.
(http://i60.tinypic.com/29yqubn.png)
The red lines should be lined up with the squares. I get the vertices by using the same joint matrices m.30, m.31 and m.32. Any idea what might cause this issue?
Code: [Select]
public float[] getJointPositions()
{
float[] verts = new float[joints.size()*6];
calculateMatrices();

int count = 0;
for(int i = 0; i < joints.size(); i++)
{
verts[count] = joints.get(i).worldMatrix.m30;
verts[count+1] = joints.get(i).worldMatrix.m31;
verts[count+2] = joints.get(i).worldMatrix.m32;
verts[count+3] = joints.get(joints.get(i).parentIndex).worldMatrix.m30;
verts[count+4] = joints.get(joints.get(i).parentIndex).worldMatrix.m31;
verts[count+5] = joints.get(joints.get(i).parentIndex).worldMatrix.m32;
count+=6;
}
return verts;
}