transform3D is non-affine!!!

hello
I am getting this bizarre exception:

javax.media.j3d.BadTransformException: TransformGroup: non-affine transform

the code that causes this is:

this.inclineRotationT3D.setTranslation(this.curVec3f);
this.collectiveT3D.setTranslation(this.curVec3f);
//collectiveT3D.add(viewingRotationT3D);
collectiveT3D.add(inclineRotationT3D);
debugTG.setTransform(this.collectiveT3D);

the final line is where the exception occurs. As far as I can tell the transform3D should be affine because its only translation and rotation.

I am adding two transform3D to get the effect of both of them into one transform3D.

Is anyone good enough to ??? explain why I am getting this error, and how to work around it.

thanx

Abos

.m33 = 1

First off, referencing variables with the same name with and withouth “this” raised a red flag. But I assume they all refer to the same objects?

Second, are you sure you want to use add? I’m no matrix export but you usually use mul when combining matrices. Adding matrices may break the affine constraints.

On a unrelated note, you use setTranslation on a T3D that has Rotation in its name! Translation only has to to with the position, and not rotation. Maybe you want to use setRotation instead.

hello

Yes the variables with and without the “this” refer to the same variables.

You are correct it was mul not add that I needed to use.

I added setTranslation on to the rotation T3D after getting the exception, in a vain attempt to sort the problem.

Thanks a lot for your help

Abos

Never add a matrix cause its evil. Also pay attention to the order you use when mul those matrices.