Question

Great toolkit and great demos!

I want to use XTK with an existing system. Is there any way to set an object's transform directly from a 4x4 affine transform matrix (ie not by rotations, translations etc)?

Was it helpful?

Solution

you can use

var transform = new X.matrix(
      [[-2.00000, 0.00000, 0.00000, 110.00000],
       [0.00000, 0.00000, 2.00000, -71.00000],
       [0.00000, -2.00000, 0.00000, 110.00000],
       [0.00000, 0.00000, 0.00000, 1.00000]]); 

object.transform().setMatrix(transform);

like in http://lessons.goxtk.com/08/

Cheers!

OTHER TIPS

XTK Toolkit used as transformation-matrix an FloatArray[16].

mat[0] = mat[5] = mat[10] = mat[15] = 1; // identity matrix
obj.transform.matrix = mat[0] = mat[5] = mat[10] = mat[15] = 1;
x = mat [12];
y = mat [13];
z = mat [14];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top