MADEAPPS / newton-dynamics

Newton Dynamics is an integrated solution for real time simulation of physics environments.
http://www.newtondynamics.com
Other
928 stars 183 forks source link

Improve Hello World #291

Closed olitheolix closed 1 year ago

olitheolix commented 1 year ago

Hi,

this is a followup to #290. After playing with Newton for a few days I have learned a lot and am genuinely impressed with it. I thus simplified my original Hello World demo and added two new ones. Hopefully, the demos will lower the barrier to entry for other newbies as well.

The Readme now contains a short description of the demos. I also updated the Github action to run the new demos as well.

I can split this into smaller PRs, if you think this one has gotten too big.

JulioJerez commented 1 year ago

wow, this is really cool man. I merged already.

the is only one observation on this line world.SetSubSteps(1);

I usually set to 2. This is an effective 128 fps. the cost of the extra passes after the first is much cheaper for few reasons. -there only one task switch. -few pass of the braid phase are per update, -the post update is also per update. -for some reason that I attribute to the large caches cpus we have today, the secund pass comes out to be about a little over half the time.

the benefit of higher update rate, save you a lot of aggravation. Physics simulation is about integration of initial value problems, in many cases, especially when putting joints, these problems are stiff system with poor convergence rate. so the one solution to mitigate drift error, is to integrate at a short time step.

your app is still a 60, so it does not make any defense form the application point of view.

and numerical integration

olitheolix commented 1 year ago

Thank you for the feedback. I will file another PR to increase the number of sub-steps in the demos.