-
Hello everyone. I am writing a visualizer for the simulator that I work on and I am having some problems to implement the selection of an object (in my case, I want to select a cube). My simulator output is a mesh made of cubes. I draw the mesh on the screen by drawing each cube individually (I know this is not the best way, and I will try to optimize it later). My problem is the following: To select a cube, I am using GetRayCollisionBox. The Ray comes from the function GetMouseRay. The problem is that the ray can hit multiple cubes (as showing in the figure below). My question is: how can I know what cube was really clicked? Is there a better way to do this witout using ray picking? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
OffBrandLaw and JeffM helped me on raylib's discord. In order to solve the problem I had to keep track of the ray collision with the smallest distance. |
Beta Was this translation helpful? Give feedback.
OffBrandLaw and JeffM helped me on raylib's discord. In order to solve the problem I had to keep track of the ray collision with the smallest distance.