Ahem… I have a normalized 2d vector. I want to rotate a quad on the gui node around the Z axis

So I did this:

```
Quaternion roll180 = new Quaternion();
roll180.lookAt(look, Vector3f.UNIT_Z);
node.setLocalRotation( roll180 );
```

However, the end result is that the node is not drawn regardless of the value of the “look” vector… any suggestion is welcome. Thanks!

prog
December 14, 2015, 1:54pm
2
Just a random shot - is scale updated to match GUI node scale?

No, I didn’t scale it… however with this code, it worked:

`roll180.fromAngleAxis( currentRotation , new Vector3f(0,0,1) );`

prog
December 14, 2015, 2:04pm
4
Then try to use asymmetrically scaled box instead of quad to see around what axis you are really rotating your node with your code - chances are that your quad is just orthogonal to camera and so you don’t see it.

I’ve noticed something wrong with the resulting Quaternion. A “good” result is something like:

(0.0, 0.0, A, B)

But instead I get:

(A, B, B, A)

I could try to zero the first two components, but something tells me that’s not the right way…

OK, apparently is orthogonal… solved with atan2 calculation.

pspeed
December 14, 2015, 4:52pm
7
new Quaternion().fromAngles(0, 0, yourAngleInRads);

1 Like