I’ve run into an unexpected exception while trying to rotate a PShape in the Z axis, even though it works fine in the X and Y axis. Has anyone else gotten this problem? It only started happening after installing 3.5 (3.5.1 and 3.5.2)
I believe this code used to work fine
shape = createShape(SPHERE,50);
ClassCastException: processing.core.PMatrix3D cannot be cast to processing.core.PMatrix2D
Oddly enough, I ran another sketch and used rotateZ by itself and it works fine, the behavior seems to be limited to PShape’s rotateZ function…
Seems like a nasty bug that should be reported to github!
I ran into this issue as well with some old code (see last post):
PShape rotations and translations…
Workaround for P3D:
// s2.rotate(heading); // Generates error in Processing 3.5.3
s2.rotate(heading, 0, 0, 1); // Workaround for P3D
I also tried P2D and some rotations were not correct for PShapes.
Workaround for P2D:
shape(s2, v1.x, v1.y);
// s2.resetMatrix(); // Shapes no longer rotating correctly!
s2.rotate(-heading); // Workaround for P2D Rotated back...
s2.translate(10, 10); // Workaround for P2D Translated back..
Also box() in P2D did not display with console message “box() is not available with this renderer.”
// box(20, 20, 0); // Does not display in P2D with console message
rect(-10, -10, 20, 20); // Works in P2D!