Jump to content

  • Log In with Google      Sign In   
  • Create Account

#ActualAssassinbeast

Posted 02 December 2012 - 04:19 PM

Hey, i just need some information on how to check collision if theres 1000 objects on the field.
And all 1000 objects are enemies to eachother.

So, do i for example have to make two for loops like this?:

[source lang="cpp"]for(int i = 0; i < objects.size(); ++i) //objects.size is the size of the vector(if i use that) for(int j = 0; j < objects.size(); ++i) collision(objects[i], objects[j]);[/source]
But thats 1000x1000 = a million loops in a single statement Posted Image

So, i just want to know if thats how you do it... cant see any other way of doing this so far Posted Image

#3Assassinbeast

Posted 02 December 2012 - 04:18 PM

Hey, i just need some information on how to check collision if theres 1000 objects on the field.
And all 1000 objects are enemies to eachother.

So, do i for example have to make two for loops like this?:

[source lang="cpp"]for(int i = 0; i < objects.size(); ++i) //objects.size is the size of the vector(if i use that) for(int j = 0; j < objects.size(); ++i) collision(objects[i], objects[j]);[/source]
But thats 1000x1000 = a million loops in a single statement Posted Image

So, i just want to know if thats how you do it... cant see any other way of doing this so far Posted Image

#2Assassinbeast

Posted 02 December 2012 - 04:18 PM

Hey, i just need some information on how to check collision if theres 1000 objects on the field.
And all 1000 objects are enemies to eachother.

So, do i for example have to make two for loops like this?:

[source lang="cpp"]for(int i = 0; i < objects.size(); ++i) //objects.size is the size of the vector(if i use that) for(int j = 0; j < objects.size(); ++i) collision(objects[i], objects[j]);[/source]
But thats 1000x1000 = a million loops in a single statement Posted Image

So, i just want to know if thats how you do it... cant see any other way of doing this so far Posted Image

#1Assassinbeast

Posted 02 December 2012 - 04:16 PM

Hey, i just need some information on how to check collision if theres 1000 objects on the field.
And all 1000 objects are enemies to eachother.

So, do i for example have to make two for loops like this?:

[source lang="cpp"]for(int i = 0; i < objects.size(); ++i) for(int j = 0; j < objects.size(); ++i) collision(objects[i], objects[j]);[/source]
But thats 1000x1000 = a million loops in a single statement Posted Image

So, i just want to know if thats how you do it... cant see any other way of doing this so far Posted Image

PARTNERS