# picking 3D objects rendered using instancing

i have a peice of code that renders a 3D image, say a cube. I require 3 cubes in in different locations, this is done using instancing and i am able to render the cube in 3 different locations. However, i now need to pick any of the 3 cubes. I am pretty new to DirectX(11) and searches online did not yeild any answers. So how i pick an object when i only have a single set of vertices(triangle) used for the render?

• ok, i went through the code again and this is how the code looks  instance_buffer[0].instanceMatrix = vector<float,4>(x,y,z,1.0f);  This line alone is enough to create an instance of the cube in the new location. So i dont see how i can get any information to perform the picking from this – introVertice Jan 21 '16 at 0:36
• @introVertice: your x, y, and z are the locations of the cube. Assuming that you have no scaling, you know that your cube is a unit cube at that location. Now take your picking ray and do a collision check against the ray and the AABB at that location. – Sean Middleditch Jan 21 '16 at 0:49