I need help for a shooting game I'm working on.

I current have a box that is 3d ( x, y, z)

I'm trying to perform a check to see if my cursor is inside this 3D box.

I understand how to make it 2d by using the max and min values but that creates a 2D box which will say I'm inside the box when in reality I'm not.

Hope someone understand this.

Maybe ill draw a pic and post it.

5 Years
Discussion Span
Last Post by firstPerson

Its the same as checking for a point in a 2D rectangle. But depending on the view of the person, you need to determine which face of the cube to check on.


I need to check if mouse is inside the box but not in the red area


- Rotate the world axis such that the cube has no rotation( i.e 'unrotate' the cube relative to the world axis)
- transform the point to be relative to the cube's position
- check if the relative point is in the un-rotated cube by doing simple bounding min-max check

Edited by firstPerson: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.