Object Selection (Working with World and Screen Space)
Objects in the 3d world can't just be selected - there are a few factors you need to account for. For instance, the camera and projection matrix - which will rotate and move the objects around - while the projection matrix will make it smaller as it gets further away.
Working with objects in 3 dimensional scenes. The figure shows us taking the position for a cube and then drawing a circle around the cube in 2d screen space with a 'div' element. As the cubes all move around the circle keeps track of the selected on with a circle.
There is two ways of doing this - we convert the 3d object into the 2d world (squash it from 3d into 2d - as the graphics vertex stage does). Or we can take a mouse position and convert it into 3d world coordinates (i.e., point to a 3d ray into the scene).
• World to Screen
• Screen to World
The following example gives you an example of a function for converting a world point (3d) to a 2d screen location:
Visitor:
Copyright (c) 2002-2025 xbdev.net - All rights reserved.
Designated articles, tutorials and software are the property of their respective owners.