Has anyone done 3D shapes and rotations with cljfx? I'm trying: https://gist.github.com/lvh/5b356405b2d79038022fe474b5fd13c1 -- but while ostensibly the rotations are getting parsed (when I inspect the output of @(renderer)
I can find actual Rotation objects with the correct values), the box doesn't appear to be rotating -- I know state updates work because e.g. color changes work fine.
Hmm, I'm not sure transforms is what you need to rotate objects
There is :rotate and :rotation-axis props on node, perhaps that's what will work
Unfortunately the use case here is getting data from an inertial measurement unit so I have pitch, roll and yaw
I guess I can use Euler’s rotation theorem to get to 1 rotation?
FWIW the reason I thought I needed transforms here was because I was working from JavaFX examples, e.g.: https://www.dummies.com/programming/java/javafx-programming-example-3d-box/
salient part:
> To rotate on more than one axis, you must use the Rotate class instead. You create a separate Rotate instance for each axis you want to rotate the object on and then add all the Rotate instances to the object’s Transforms collection via the getTransforms().addAll method, like this:
Rotate rxBox = new Rotate(0, 0, 0, 0, Rotate.X_AXIS);
Rotate ryBox = new Rotate(0, 0, 0, 0, Rotate.Y_AXIS);
Rotate rzBox = new Rotate(0, 0, 0, 0, Rotate.Z_AXIS);
rxBox.setAngle(30);
ryBox.setAngle(50);
rzBox.setAngle(30);
box.getTransforms().addAll(rxBox, ryBox, rzBox);
A similar project I found using plain JavaFX appears to try very hard to turn all rotations into 1 affine transform, but it mostly just does that so it can see the sum of the rotations and display that separately: https://github.com/tschuett-munich/gyro-to-javafx/blob/master/src/de/roboshock/javafx/gyropuppet/RotationTracker.java
that said even if I did that I'd still have an Affine at the end and there doesn't appear to be a better place to put that than :transforms
uh wtf
I just did exactly the same thing and now it works
well, I'm sure it's an issue with only half the code being updated or something
OK, so I think the problem is that I'm rewriting root
but of course that has an old reference because it takes the fn and not #'root
I was expecting calling the renderer to fix it but because root
itself is changing I need to build an entirely new renderer, I'm not just updating state
anyway now I have a beautiful slanted box, thank you 😄