Closed
Description
The p5.xr library implements a number of functions for raycasting in VR/AR:
- rayObject = {origin: p5.Vector, direction: p5.Vector}
- generateRay(Number x1, Number y1, Number z1, Number x1, Number y2, Number z2) - returns rayObject
- intersectsBox(Number width, [Number height], [Number depth], [rayObject ray]) - returns boolean
- intersectsPlane([rayObject ray]) - returns p5.Vector(2D)
- intersectsSphere(Number radius, [rayObject ray]) - returns Boolean
- getRayFromScreen(Number screenX, Number screenY) - returns rayObject
These could be useful to add to the VR/AR libraries in the Android mode.
More information:
Implementation: https://github.com/stalgiag/p5.xr/blob/master/src/p5xr/core/raycasting.js
Examples: https://github.com/stalgiag/p5.xr/tree/master/tests/manual-test-examples/p5vr/raycasting
Doc discussing design/implementation: https://docs.google.com/document/d/1JzvLBAQuh7gydo0Wpk0UhdgbTBkSekFp-uoKKSUN5Xg