Open GoogleCodeExporter opened 8 years ago
I'll mull this one over. The main reason I have it as object1/object2 is so
that
you could swap out CollisionGroup and CollisionList without having to rewrite
any of
the code handling the collision. If I specify target for CollisionList, but
still
have object1/object2 for CollisionGroup, then implementation changes between
the
two.
However, I agree that specifying the target in CollisionList would improve
performance by eliminating checks, so I'll think it over.
I should note that you get a wee bit of help in discerning between object1 and
object2 in that object1 is always the smallest of the two involved in the
collision. So in situations where your target is always smaller or larger than
your
other items in the list, you always know if it's object1 or object2.
Original comment by lessthan...@gmail.com
on 22 Jun 2009 at 7:36
How about this:
In the case of CollisionGroup, object1 will always be the smaller of the two
objects
(as it is now)
In the case of CollisionList, object1 will always be the target.
This way we can have a Collision object being returned (re: your issue for
typed
objects from checkCollision()) that is the same structure for both
CollisionGroup
and CollisionList, making it painless to swap between the two.
Shoot, I can have a "target" property in the class anyways and just use it in
the
case of CollisionList if you think it's worth it.
Original comment by lessthan...@gmail.com
on 22 Jun 2009 at 8:14
I can live with the option you described in comment #2. However I do much
prefer the
target/collisionItem option Mike described. I do not see a scenario where I
would
first choose to use CollisionGroup and later swap it for CollisionList. When
you have
a clear goal on what you're building you choose either one and never swap. Often
clear and easy code outweighs flexibility.
Original comment by e.verd...@gmail.com
on 24 Jun 2009 at 5:23
Original issue reported on code.google.com by
mikechambers
on 21 Jun 2009 at 10:59