F
Flab
Guest
Having coded physics engines and collision detection stuff (quite a lot), I tend to disagree. I think you'd find in many physics engines that contacts/collision events are minimized (for good reason) and that in say, a typical impulse based rigidbody engine, a single "event" basically "weights" collision response for both objects (not entirely since you tend to have multiple force/impulse vectors to account for with the planar and friction directions possibly other constraints, etc). This is of course only about the physics, but it is a fair enough example. Apart from that, for instance, I've rarely (if ever) had to have multiple collision response events even for different kinds of objects. Normally it's down to like:I have never had issues with events firing in both instances rather than just the once.
Even hypothetically I cannot think of any cases where it would be preferential.
Most of the time you are looking at collisions between different instances anyways so the event will only fire in the instance with the event.
Also, this would cause issues when parenting is used. All of a sudden, you would ether break your projects, or have the event firing in each instance, as opposed to firing just in one of the istances.
I also cannot think of any physics engines that only generate collisions for the one instance. Though, most of them actually use manifolds, but thats not really compatible with GM's instance model (What instance should get the manifold?).
The most important Issue is deciding on what instance should get the event.
If you have a bullet colliding with an enemy: your bullet now needs to know about every response an enemy can have to being hit by a bullet, because it could be recieving the event, and not the enemy,
As you can see, single events rather than events in each instances cause a few problems.
" if (objA.type < objB.type) coltypefunc[objA,objB]; else coltypefunc[objB,objA]; " Edit: Sorry that doesn't quite describe what I mean, rather just that you (can) only use one func for collision between the two object types.
Hey, I dunno. I can understand in some cases where it's preferable.
Here's an example of where duplicates causes degeneracy in GM:
Enemy can damage other enemy (even if temporarily) by touching it. If you have damage based on collision event, how many times will they damage each other? It's pretty easy to list more.
Last edited by a moderator: