-
-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Increase usability of broadphases #63
Comments
A more general broadphase definition would be the right approach. If it were me, I wouldn't hesitate to break compatibility a bit if it makes for a better or clearer design (similar to our getRotation discussion earlier). I would have it operate on Shape objects, since any shape should be able to produce an AABB. In addition, if we ever wanted to try out a Circle-Circle detector or OBB detector we could add more methods (createBoundingCircle, createOBB). |
Good to know that you support the idea. I'm going for something more general that the Shape class; For my own use case with the CCD improvement, what I need is to support broadphase detection once per body (so could be multiple shapes) with I'm currently thinking that the most general approach is
and
Then we'll have all broadphases work just with BroadphaseObjects. One question with this setup is: for the current use case of broadphases, should How do all these sound to you? I'm interested about your opinion about whether we can add that extra |
I'd was thinking something like this:
My thought is that a bounded "object" is a more general concept than an object being useful for a Broadphase collision detection algorithm. Instead its a geometric concept. Naturally, all we need right now is createAABB, but this would allow us to expand to use other bounding types in the future. This also allows us to define the Bounded contract where it belongs in the geometry package without a (at least by name) coupling to the broadphase package. The only downside of operating at the Body level in the Broadphase is with multi-fixture bodies. Once you detect via the Broadphase that two bodies are potentially intersecting, you now have to use a Narrowphase against every pair of fixtures (n*m tests). The downside of having it Fixture based is the requirement of the I would just keep the current design of a |
An additional interface describing geometric primitives is fine with me, but this does not solve my needs for a general broadphase. How will a broadphase work with either Bounded or TemporarilyBounded? How will it work with anything else than these? I think I’ll try an implementation based on the notion of BroadphaseObject and see how I can reduce code duplication and keep the interface same or similar. The reason I need this change is because with the new CCD changes I’m making the performance gain is insane. If you want to provide any additional guidance feel free to comment here. I’ll add a link to my branch here as soon as I have some first working code. |
In my view, the interface The interface
Not a problem, I must have misunderstood what you were saying.
If you don't need it at the shape level - ignore it. The point I was trying to make was that the interface that describes the idea of "being bounded" could be applied/useful in many scenarios other than the Broadphase. For example, knowing the bounding shape (circle, AABB, OBB, etc) for a given Body - while not useful internally - could be useful to user code.
Again, I'm not suggesting that we do any of these, but trying to drive home the idea that "being bounded" was a more general concept.
I appreciate all the contributions and I'm truly looking forward to it. |
Thanks for the reply and further notes. They’re indeed functionally the same, I was actually confused because I had a different use case in my mind. Your approach is better imo, but I somehow need to have broadphases work on a single Bounded object and not require extra information. It would be nice at that point to have a Body field in fixtures, but that requires even more changes in the library. I’m not really sure what’s the desired solution at this point. I’ll give it some extra thought. |
@mtsamis Are the changes you were thinking about implementing here still valid? Should we close this issue? |
Hey, yeah we can close this. The discussion was good back then. I think the successor to this concept is your newer issue #122 |
I'm working on some improvements for the CCD which give huge performance gains. I need to use a broadphase detector that acts just on bodies, but all broadphases currently only work with <Body, Fixture> pairs. I was thinking that broadphases are useful in a wide range of scenarios, not just for <Body, Fixture> pairs.
It would be useful (maybe?) to make them more general, that is they should work for any 'object' with a corresponding 'createAABB' method.
@wnbittle I'm searching for some design ideas on how to achieve this while not changing much the current interface of broadphase detectors (Maybe a more general broadphase class which has a subclass that provides the exact functionality they currently have?).
The CCD improvement is huge, so this is overall quite useful.
Any help/discussion apreciated
The text was updated successfully, but these errors were encountered: