Comments (14)
After I came up with the idea, I lost motivation, so I closed it.
I'll leave it up to contributors to decide what to do with this discussion. Personally, I think it would be nice to have a function that simply returns screen coordinates and depth values for 3D coordinates.
from p5.js.
Personally, I think it would be nice to have a function that simply returns screen coordinates and depth values for 3D coordinates.
I too agree to this , it would be nice to have such a function.
Just a suggestion ,
How about naming the function worldToScreen(coord)
?
This name is descriptive and indicates that the function converts 3D world coordinates to 2D screen coordinates.
from p5.js.
Having a function like this will help contributors create new methods, like I did in #6116. I also think it is useful because it can be used to place visual information in 3D space.
2024-06-03.21-46-57.mp4
from p5.js.
I think this could make sense to add, anecdotally it's probably the question I've been asked the most about p5, although not exclusively to WebGL, so 2D mode could feasibly implement something like this too.
@limzykenneth any thoughts on naming? Flash used to have methods like localToGlobal(coord)
and globalToLocal(coord)
, for inspiration.
(Also, I reopened the issue, was it intended to be closed?)
from p5.js.
FYI - I brought up this issue with @bohnacker years ago (while attempting to port a Processing lib to p5.js that depended on screenX/Y/Z) and they came up with the following solution (I'm not sure if it's been submitted for the upcoming new website (of which all existing ones should be auto-ported incase authors didn't see message to submit) – would of course be great to have them built in!
https://github.com/bohnacker/p5js-screenPosition
from p5.js.
Related Issues (20)
- Fix broken link in documentation_style_guide.md
- Should setCamera() also call resetMatrix()? HOT 6
- get() and/or pixelDensity() lag since v1.8.0 HOT 1
- background with alpha unexpected behavior HOT 1
- Current status of maintenance tasks, package audits, tracking tech debt, etc HOT 2
- On Latest Version of Safari SetUniform Doesn't Update in Draw Function HOT 7
- cam.ortho() on framebuffer cameras and no args uses the size from the main canvas
- Should `createCamera` still auto-set itself as the default camera? HOT 9
- inconsistent parameter handling HOT 2
- Possible bug with trigonometry functions HOT 2
- getting wrong language in the console. HOT 9
- Hit detection on 2D Shapes HOT 1
- Docker implementation HOT 3
- Broken link to dev_notes.md in the documentation HOT 1
- "point" class documentation text misprint HOT 9
- p5.Vector reflect() unexpectedly modifies surface normal argument HOT 3
- [p5.js 2.0 RFC Proposal]: Pruning HOT 2
- orbitControl() customizability HOT 3
- clearDepth() example broken
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from p5.js.