Converts 3D world coordinates to 2D screen coordinates.
This function takes a 3D vector and converts its coordinates from the world space to screen space. This can be useful for placing 2D elements in a 3D scene or for determining the screen position of 3D objects.
Examples
Syntax
worldToScreen(x, y, [z])
Parameters
x
Number|p5.Vector: The x coordinate in world space. (Or a vector for all three coordinates.)
y
Number: The y coordinate in world space.
z
Number: The z coordinate in world space.
Returns
p5.Vector: A vector containing the 2D screen coordinates.
Notice any errors or typos? Please let us know. Please feel free to edit src/core/environment.js and open a pull request!