ok I think I have fixed now, please check it out, check multy threaded also.
I noticed the demo freezes at random for long period of time, the freeze is not in the newton side, it seems to be is some garbage collision or some management. But maybe you have than under control.
Works Great Now (multithreaded and single)! The bouncing of the top most spheres is much more natural looking across all the towers as well. With the center sphere bouncing the highest and the effect gradually declining as you look at shorter towers.
I do get freezes under seemingly heavy load (although I dont get any freezes in the demo I posted) I will look into it.
I have altered Urho3D to prioritize its logical updates over its rendering so if the logical update routine becomes too long the engine will never get a chance to render. I'm not sure how I want to handle that. Maybe I'll force renders every once in a while if there is too much load.
Edit: when I set to single threaded and debug mode and I get a freeze - I hit pause on the debugger and see that it is usually doing math inside a dVector or something which is what I was expecting.
MeltingPlastic wrote:Edit: when I set to single threaded and debug mode and I get a freeze - I hit pause on the debugger and see that it is usually doing math inside a dVector or something which is what I was expecting.
yes but that is not what is slowing down, if you set a break point to the line after the NewtonUpdate you will see that it returns many times but there is no rendering, I am not sure what but I leave that to you unless. There are no periodic functions in newton that execute every so often, when is slow in one frame it will be slow for many frame.