Hi
I executed this code twice with only the modification of changing the b in line 10 to boxG and the boxG in line 12 to b:
1 Odejava.getInstance();
2 world = new World();
3 GeomBox boxG = new GeomBox(280, 60,240);
4 GeomTransform t = new MyGeomTransform();
5 t.setEncapsulatedGeom(boxG);
6 Body b = new Body("boxBody",world);
7 b.addGeom(t);
8 b.adjustMass(1);
9
10 b.setQuaternion(new Quat4f(0,0,0,1));
11 boxG.setPosition(20, 600, 30);
12 boxG.setQuaternion(new Quat4f(0,0.7071068f,0.7071068f,0));
13 geoms.add(t);
14 System.out.println("boxG: "+boxG.getQuaternion());
15 System.out.println("t :"+t.getQuaternion());
16 System.out.println("b :"+b.getQuaternion());
17 System.out.println("Transform: "+t.getTransform());
18 System.out.println("Rotation: "+t.getRotation());
19 System.out.println("axisA: "+t.getAxisAngle());
20 System.out.println();
21 System.out.println("boxG: "+boxG.getPosition());
22 System.out.println("t :"+t.getPosition());
23 System.out.println("b :"+b.getPosition());
[tr][td]
without modification:
boxG: (0.0, 0.70710677, 0.70710677, 0.0)
t :(0.0, 0.70710677, 0.70710677, 0.0)
b :(0.0, 0.0, 0.0, 1.0)
Transform: -0.9999999, 0.0, 0.0, 20.0
0.0, 5.9604645E-8, 0.99999994, 600.0
0.0, 0.99999994, 5.9604645E-8, 30.0
0.0, 0.0, 0.0, 1.0
Rotation: -0.9999999, 0.0, 0.0
0.0, 5.9604645E-8, 0.99999994
0.0, 0.99999994, 5.9604645E-8
axisA: (0.0, 0.70710677, 0.70710677, 3.1415927)
boxG: (20.0, 600.0, 30.0)
t :(20.0, 600.0, 30.0)
b :(0.0, 0.0, 0.0)
-> Box is rotated.
[/td][td]
with modification:
boxG: (0.0, 0.0, 0.0, 1.0)
t :(0.0, 0.70710677, 0.70710677, 0.0)
b :(0.0, 0.70710677, 0.70710677, 0.0)
Transform: -0.9999999, 0.0, 0.0, 403.05087
0.0, 5.9604645E-8, 0.99999994, -14.142136
0.0, 0.99999994, 5.9604645E-8, 14.142136
0.0, 0.0, 0.0, 1.0
Rotation: -0.9999999, 0.0, 0.0
0.0, 5.9604645E-8, 0.99999994
0.0, 0.99999994, 5.9604645E-8
axisA: (0.0, 0.70710677, 0.70710677, 3.1415927)
boxG: (20.0, 600.0, 30.0)
t :(403.05087, -14.142136, 14.142136)
b :(0.0, 0.0, 0.0)
-> Box is not rotated.
[/td][/tr]
The position of the Box is in both cases the same.
I think this is totally strange espacially because the rotation-output does not show any signs, that there might be differences, but RunDemo shows different rotations.
The positions are different, but RunDemo shows the same position.
My only conclusion is, that I’ve misunderstood something, or rundemo is not working correctly.
PS: The updateCachedTransform is used. I’ve checked that.