문제

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)?

도움이 되었습니까?

해결책

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!

다른 팁

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];
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top