stalgiag / p5.xr

a library that helps turn p5.js sketches into immersive experiences using WebXR
GNU Lesser General Public License v2.1
117 stars 25 forks source link

AR camera Y-axis flipped? #245

Open ffd8 opened 5 days ago

ffd8 commented 5 days ago

Nature of issue?

Which area does this problem relate to?

Details about the bug:

Loading the demo of a cube worked great, same as other forms, until loading text and then 2 things occured

  1. the y-axis seems flipped (solved when adding scale(1, -1)
  2. there is wild z-axis fighting on the letters..

Guessing z-axis issue has to do with it being rendered 2x for the lens? Perhaps only an issue for the emulator, since it's flattening the eyes? And maybe the issue with the flipped y-axis is also an emulator bug, not the library? Will try to test on an actual device asap.

Here's some visual examples of issue:

Flipped Y-axis with type:

Screenshot 2024-11-12 at 23 52 06

Fixed with scale(1, -1):

Screenshot 2024-11-12 at 23 52 13

Issue of Z-axis fighting when rotating the text:

Screenshot 2024-11-13 at 00 31 35
ffd8 commented 1 day ago

one more thing to add – it's also perhaps tricky for p5 beginners that the scaling is so different than what they're used to.. everything is mm versus p5 pixels relative values? Perhaps adding a function or option like scaleMode(P5) vs scaleMode(MM), could simplify that? It could both flip the yaxis as mentioned above and allow one to use more expected values, where I'd expect something like fontSize(150), translate(0, 0, -400), etc.