Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.



This topic is 5915 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

how much would it downgrade speed drawing 850 cubes to the screen and checking for collisions with all of them? i mean would it be heaps or just a little?

Share this post

Link to post
Share on other sites
Excuse me, I don''t know much about collision checking, and maybe I''m totally wrong, but:

Wouldn''t the number of checks be

850+849+848...+1 = (850+1)*(850/2) = 361675 ?

That''s a little bit less than 2^850...


Share this post

Link to post
Share on other sites
FunkyTUNE!!! is correct. By doing 850*849 you're repeating *alot* of checks. Take this example, you have objects A, B and C.

What your loop will do is this:
1st interation of outer loop:
(A,B), (A,C)
2d interation of outer loop:
(B,A), (B,C)
3rd interation of outer loop:
(C,A), (C,B)

However notice that in the 2nd interation we've already checked AB, and in the third interation we've already checked AC and BC.

You want to do this:

(A,B), (A,C)

This can be accomplished with this code (Assuming areas are Low to High):

for I=Low to High-1
for J=I+1 to High
next J
next I

[EDIT]: Correct horrible insult to FunkyToon, ...eer tune

[edited by - michalson on May 6, 2002 8:27:08 AM]

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!