space.Clear()

Post and discuss features you'd like to see in the BEPUphysics library.
Post Reply
snoozbuster
Posts: 172
Joined: Sat Sep 24, 2011 7:31 am

space.Clear()

Post by snoozbuster » Wed Dec 21, 2011 11:06 pm

So, remember how I was talking about putting a Clear() function in Space? Well, I decided to actually do that, since extensions just weren't cutting it for me. Here's a copy of Space.cs, in case you feel like using it. I marked all the spots I changed with // AGV. I also modified ISpace.cs to have a method stub for Clear().

The reason I use while(objectList.Count > 0) instead of foreach in Clear() is because objects get removed from the list in Remove() (and any recursive calls thereof), thereby invalidating enumerators and crashing. This works just as good.
Attachments
ISpace.cs
(4.68 KiB) Downloaded 263 times
Space.cs
(29.02 KiB) Downloaded 309 times

Fe_Yoshi
Posts: 397
Joined: Tue Jul 04, 2006 5:05 pm
Location: New Tower!

Re: space.Clear()

Post by Fe_Yoshi » Sat Dec 24, 2011 6:57 am

Clearing space would be helpful in getting rid of all that nasty debris and asteroids, but we'd also lose the planets and stars!!!

Please don't end all of existence mister :(
It's simple, just take the hydraulic phase ship emulator and attach it to the photon particle emitter, BAM, new tower!

snoozbuster
Posts: 172
Joined: Sat Sep 24, 2011 7:31 am

Re: space.Clear()

Post by snoozbuster » Sun Dec 25, 2011 4:19 am

Fe_Yoshi wrote:Clearing space would be helpful in getting rid of all that nasty debris and asteroids, but we'd also lose the planets and stars!!!

Please don't end all of existence mister :(
Don't worry. I won't.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest