Skip to main content
6 events
when toggle format what by license comment
Jul 11, 2012 at 12:25 vote accept Djentleman
Jul 11, 2012 at 12:24 comment added Marton You're welcome! Sorry I couldn't post the loop from my actual collision management code, I'm at work right now :-) I'm pretty sure you can fit it to your own needs though.
Jul 11, 2012 at 12:19 comment added Djentleman Yeah, I've been working on using interfaces for polymorphism (I use ISpatialNode for my quadtree lists), so that makes sense to me. This is a great solution and means I'll only need one quadtree, so thanks!
Jul 11, 2012 at 12:11 comment added Marton You don't have to worry about this unless you have millions of objects. This is a really lightweight class, it won't have any visible impact on the performance of your application. I need to mention though, that I've also defined an ICollidable interface, and all collidable objects implement this. So in practice, the Victim property is of ICollidable type, and the Colliders property is of List<ICollidable> type. This means, I don't have to do as many casting operations.
Jul 11, 2012 at 11:51 comment added Djentleman I like this solution, having a Collision class is clever. But it is really efficient? Having a wide variety of characters moving around the environment alone would generate a significant amount of collisions every frame, wouldn't it? Would it perhaps be better to have a separate case for objects colliding with the environment, one that doesn't create classes?
Jul 11, 2012 at 7:41 history answered Marton CC BY-SA 3.0