mardi 23 juin 2015

Get coordinates of mouse click in 3D scene

I’m running into an issue that I think probably has a relatively simple solution but is outside the realm of my mathematical know-how.

I have a scene set up for a game in which the camera is positioned above the playing field, looking straight down. As an example, the coordinates of the camera might be: x:25,000, y:10,000, z:0.

What I’m trying to do is determine the position of a mouse click in the scene. Since I’m looking straight down at the map, I need a way to determine the X/Z coords (Y is always 0) based on the X/Y position of the mouse click on the stage and the position of the camera.

I don't think it's necessary for the scope of the problem, but I'm working with AS3 and Away3D.

Does anyone know a formula that would provide this information?

Aucun commentaire:

Enregistrer un commentaire