flame icon indicating copy to clipboard operation
flame copied to clipboard

Separate onComponentTypeCheck on two functions

Open ASGAlex opened this issue 2 years ago • 2 comments

What could be improved

Currently onComponentTypeCheck runs per-component and allows to decide if one component could ever to collide with another. The result is also saved per-component, so iw we have 1000 components with same type - there will be cache storage with 1000 results. In other hand, it allows to check some of component's instance parameters but only once.

Why should this be improved

We could introduce additional function, for example pureTypeCheck which will really check just only Type of components. Using this instead of onComponentTypeCheck might to improve functionality because:

  • The check itself is simplier.
  • The array of cached results is much smaller: for 1000 components with same type we will have just 1 record in cache.

It also worth to keep original onComponentTypeCheck as is, but describe the difference in documentation

Any risks?

Fine-tuning of collision detection system makes it more and more complicated, but this functions can be ignored if not needed.

More information

I already have tested implementation and can port it into Flame's core.

ASGAlex avatar Jun 28 '23 20:06 ASGAlex

Sounds good as long as we implement it for all (both) broadphases, so that we don't drift too far away functionality wise on them.

spydon avatar Jun 28 '23 20:06 spydon

To be honest, I'm not too familar with sweep broadphase implementation to port such functionality into it - remember, I already tried once, and totally failed with that.

ASGAlex avatar Jun 28 '23 21:06 ASGAlex