- click on the screen
- emit a ray from the camera
- select objects colliding with ray
- After you follow the tutorial, you will get a
glm::vec3 ray_world
. Now, you can calculate the intersection point between the ray and planes.
- Cannot select the objects closest to the camera. But you can easily implement it by yourself. To be specific, you need to calculate the distance between the camera and the hit point. Object with min distance would be selected.