Bounding box, silly issues help please!
Moderator: InsideQC Admins
2 posts
• Page 1 of 1
Bounding box, silly issues help please!
I have a game world, with all entities being contained by a bounding box. This is working fine, i am in the process of updating my collision code. However im having issues with deciding if objects are colliding am i doing this right? If not where am i going wrong?
I have object A and object B with x y and z max and minimums of them all.
1) (if object A min X >Object B max X OR object B min X >Object A max X)
X axis is colliding
(if object A min Y>Object B max Y OR object B min Y >Object A max Y)
Y axis is colliding
(if object A min Z >Object B max Z OR object B min Z >Object A max Z )
Z axis is colliding
if X / Y and Z axis are colliding then i have a collision
I have object A and object B with x y and z max and minimums of them all.
1) (if object A min X >Object B max X OR object B min X >Object A max X)
X axis is colliding
(if object A min Y>Object B max Y OR object B min Y >Object A max Y)
Y axis is colliding
(if object A min Z >Object B max Z OR object B min Z >Object A max Z )
Z axis is colliding
if X / Y and Z axis are colliding then i have a collision
- boxrick
- Posts: 5
- Joined: Tue Jan 20, 2009 12:15 pm
don't you mean:
if (a.min_x <= b.max_x && a.max_x >= b.min_x &&
a.min_y <= b.max_y && a.max_y >= b.min_y &&
a.min_x <= b.max_z && a.max_z >= b.min_z)
collide();
if (a.min_x <= b.max_x && a.max_x >= b.min_x &&
a.min_y <= b.max_y && a.max_y >= b.min_y &&
a.min_x <= b.max_z && a.max_z >= b.min_z)
collide();
- Spike
- Posts: 2892
- Joined: Fri Nov 05, 2004 3:12 am
- Location: UK
2 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest