I'm working on a puzzle game that involves a cube formed of multiple cubes itself (i.e. rubik's cube). I want users to be able to highlight an individual cube by clicking on it.
The only way I was able to implement this is by projecting a small object from where the mouse is at the moment of the click over the z-axis until I detect a collision with a cube.
It works fine, but the problem is the perspective. Since the projection is on the z-axis, the highlighted cube isn't always directly where the cursor is, because of the perspective.
Anyone has a better way to do this?
Thanks.
The only way I was able to implement this is by projecting a small object from where the mouse is at the moment of the click over the z-axis until I detect a collision with a cube.
It works fine, but the problem is the perspective. Since the projection is on the z-axis, the highlighted cube isn't always directly where the cursor is, because of the perspective.
Anyone has a better way to do this?
Thanks.