Crosshair in 3D first person game

I have created a 3D box on a layer called UI, which is the cursor, and the player and the level is on the base layer. I tried making things happen when the E key is pressed and the crosshair box is in collision with an object in the level. Of course, this did not work, because they are on different layers. I tried putting the crosshair box on base layer, (I was using the community made align object extension) but the crosshair box just stayed floating in the air, no matter if I moved and looked around. Please help me make it so there is a crosshair, and when I look at an object and press ā€œEā€, it does an action.

1 Like

So the crosshair moves with the cursor? Then check whether the cursor is on the object on the base layer. Just make sure you include the layer of the object as the parameter and 0 from the camera when getting the cursor position:

1 Like