if you are refering to this:
Marc wrote:All the casts I do right now are independent, so I don't need to have the result of one cast to know what cast I'll be doing next. I could batch all casts up and execute them all at once and process all the various results afterwards. So from the controller's side, it could be batched. But is it possible to do it with newton's collision system? Maybe with newton 3xx ?
To me batching is the prosses of doi a buch of similar operation in on function call. teh way teh engien does that is by usin teh thread pool.
if you refert to the idea of putting a bunch of calles in thread and letting it run asycronous.
There are some engines that do work like that and they use a double buffers internally to go around syncronization logic.
when I made newton 1.00 mutithreaed teh first time, I tried that, but after a while I found it too complicated for both the client application and the intenal engine logic.
The way Netwon works is that id does task in pareallet and syncronize at a exit pointm teh do a noteh buck of tasck and syncronize again, and so on.
if you fo example place a bunck convex cast on a thread to work a asycronnous, then the Bradphase will have to have a lock/unlock mechannish
each time is going to update the location of a cell inetranlly of exrenally,
this will bring the engine back to the original point when collisions were objects, not intances.
by this I mean the Broadphase in the engine is not reentrant to support that funtionality eassilly.
On this
Marc wrote:Right now, assuming you have N objects in your scene. I assume newton has some sort of spatial tree structure where it puts the objects in. So from a theoretical point, doing an AABB Query in the scene is O(log N) I guess. I also guess that convex cast basically does an AABB Query first and then does something linearly with the resulting objects, so its complexity is O(log N) as well. Now, if I have a Convex Cast in every logic code of every object, that makes N Convex casts, which results in a complexity of O(N log N) for all convex casts.
Now, what I was thinking, but maybe it's wrong, is the following: Assuming I know all N Convex Casts upfront, I could somehow batch them all together and just query this against the newtonworld. I'm not exactly sure how, but I'm thinking that this way, one could achieve O(N) as a complexity for N Convex casts.
Is this wrong?
yes this is all correct, however you are making a common mistake of applig teh time complxiti of an algorithm to an applictaion.
Ye is is true that teh braod phase is and O(lonN) query.
but a phsocs engien, just loekl a graphics engien is mand of many diffrent algorithm,
for exemple the broadp phase is an O(log n), by say you have a lareg mehs trryy in teh braod phase, oarehap more than one
you shape may toufh few of those, and a collison
a collsion tress also have a o(m *logn) when m is teh numbe of face tah hit the oobb.
a terrai high field isn conatct time by report more faces,
a convex cast has a comples time complxity. and so on.
so bascially you are tlaking of bacthing the outer layer of the engine (the braad phase)
but I am positive that of the total time that is the part that is most insignificant.
can you tell my about how your scene is made off?