ok if you sync again you soudl get the thsi have behavior when setting auto sleep off
1) Wordl.Update() - OnAabbOverlap() called - false returned - bodies remain overlapped - OK
2) Wordl.Update() - OnAabbOverlap() called - false returned - bodies remain overlapped - OK
3) Wordl.Update() - OnAabbOverlap() called - false returned - bodies remain overlapped - OK
4) and so on
and this when auto sleep is on
1) Wordl.Update() - OnAabbOverlap() called - false returned - bodies remain overlapped - OK
2) Wordl.Update() - OnAabbOverlap() is not called ! - bodies remain overlapped
3) Wordl.Update() - OnAabbOverlap() is not called ! - bodies remain overlapped
4) and so on
on this
zak wrote:1) Shouldn't be SetAutoSleep( false ) called once and always be active, so that body never goes to sleep?
2) Shouldn't be OnAabbOverlap() called even if bodies are in sleep state?
again, the concept of sleep is newton 4 is more sophisticated than a flag the
SetAutoSleep( false ) mean teh body get the inputs, teh callback, and get integrated. but the solver determine of the body is part of the solution or not. onel bodies that are not in equilibrium are part of the solution. this is diffrent than earlly version 3.xx where autosleep of meant a body is part of teh island. but the latest version of 3.xx (3.12 and 3.14) this new concept started to be added and is a major part of the new ways of 4.00
OnAabbOverlap(). no, if they are sleeping and in equilibrium them is not not called.
I know that it seems that is should be called simply because they are overlapping, but that impose such a huge penalty in the engine for a very small payoff, that I decide it is better this wasy.
you can check this by looking at file ..\newton-4.00\sdk\dCollision\ndScene.cpp line 1490
you can see that when the engine is going to performe the scene scan, if first determine how many bodies in teh scene are not in equilibrium.
if more that 2/3 of the bodies in the scene are sleeping and in equilibrium
the then engine does tow sweep and prune scans. on teh active bodies.
if not is does a sweep and prune on all bodies.
when doing a single sweep and prune on all bodies this check all pair. and because contact are generated onle when aabb overlap, the, teh app get the onAabbOverlap
then the solver find that the bodes are are rest, and next time the check find that less that 1/3 are active (zero in teh case) so is does the tow pass scans.
the two pass scan is one from left to right when is check each active body versus the scene, but as you can see, is start with an active body.
you can check this by hacking uncomment line 1505 in same file, and you will see that you will get teh callback each time.
the 2/3 is because of profile testing in scene with few hundred bodies. it seem that threshold should be 1/2 but liek every thong on computers, my empirical test shows that on large scenes most of the time more than 2/3 of the bodies are at rest. so doing this only when a smaller that 1/3 of the bodes are active result on the partial scans been more than 90% of the way of operation.
yes I know that if we did this huge performance collapsing demos or pyramid of gazillions bodies that is will do full scan, but I am no longer interested on those kind of test.
so to summarize you are right, ideally OnAabbOverlap sould be call, but for newton 4.00 that's a limitation we have to live with untill we can find a better way.
notice that thsi does no change the behavior, is you result true the first time time, the behavior will be as expected.
plus the application can do a test like.
return dOverlapTest(rootNode->m_minBox, rootNode->m_maxBox, boxP0, boxP1) ? 1 : 0
so i tis not like is a show stopper bejavior.