LWJGL Forum
Programming => General Java Game Development => Topic started by: Azraton on May 17, 2016, 12:31:06

Hello,
I want to do some basic collision detection in 3d space. In order to do that, I need hitboxes and a method to check if two hitboxes intersect or contain each other.
Could someone please tell me how to create a simple hitbox (a cuboid or something) around an 3d object and how to check if they intersect/contain each other?
Thanks,
Azraton

Your 3d object is a bunch of vertices, right?
And those vertices have a position, right?
The easiest thing is to build a socalled "AxisAligned Bounding Box" (AABB for short).
You should be very capable of figuring out how to create such an AABB from your set of vertices.
As for checking for collision between two AABBs, there are two possible ways:
The easiest is to just check two AABBs statically whether they intersect or not.
That is, given two AABBs, specifically their current position, check whether they intersect.
You could simply google for "AABB intersection test" and you'll find numerous examples and explanations.
The next more sophisticated way is to assume that the two AABBs move in a game between two successive intersection checks. When they move fast enough, they could intersect in between two frames and not intersect at the checks at each frame. To remedy this, there is another algorithm which you can google for with "swept AABB collision".

Hello Azraton
i am also working for same project. i need some guidence about collision detection in 3d space .can you help me please ?
best regards
steve smith

Well its like a simple math question like how to find x? so simply just find the right codes from which you can make boxes and follow the rules of mathematics to create boxes.