Index | FAQ | Search | Memberlist | Usergroups | Profile | Log in to check your private messages | Log in | Register

Bounding box, silly issues help please!

| Inside3d Forums Forum Index -> General Programming

View previous topic :: View next topic
Author | Message
--- | ---
boxrick Joined: 20 Jan 2009 Posts: 5 |

Posted: Thu Mar 05, 2009 10:51 pm Post subject: 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

Back to top |

Spike Joined: 05 Nov 2004 Posts: 944 Location: UK |

Posted: Thu Mar 05, 2009 11:14 pm Post subject: |

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();
_________________
What's a signature?

Back to top |

Display posts from previous:

| Inside3d Forums Forum Index -> General Programming | All times are GMT
Page 1 of 1

Jump to:

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Powered by phpBB © 2004 phpBB Group