Newton plug-in for Unity 3D

Share with us how are you using the powerrrr of the force

Moderator: Alain

Newton plug-in for Unity 3D

Postby jay3d » Sun Jul 26, 2015 4:39 am

Hi!

This is my WIP Newton plug-in for Unity 3D.
Still at early stages.
I'm doing that because I'm not satisfied with the PhysX engine that Unity uses, due to many problems with stability and accuracy.

https://www.youtube.com/watch?v=NZuVWSb ... e=youtu.be

Thanks Julio for such a great engine!
jay3d
 
Posts: 33
Joined: Sun Jul 13, 2008 11:51 am

Re: Newton plug-in for Unity 3D

Postby Julio Jerez » Sun Jul 26, 2015 12:23 pm

wow, Unity, that's nice.
I never expected any one to put newton in Unity. My understanding was that you could no add a source code plug in unless you get the expensive license.
Bu I like to see newton in a High end engine. :mrgreen:
are you using 3.14?
Julio Jerez
Moderator
Moderator
 
Posts: 10718
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Newton plug-in for Unity 3D

Postby jay3d » Sun Jul 26, 2015 10:12 pm

Glad u liked it :D

Yes I'm using latest trunk of Newton, and I'm implementing more stuff.
It proved to be much much powerful than the built in engine (PhysX).
I did compiled it for Android too and it works perfectly on my phone when exporting from Unity.

I noticed that Mingw32 GCC gives higher performance than the DLL compiled with VS.
jay3d
 
Posts: 33
Joined: Sun Jul 13, 2008 11:51 am

Re: Newton plug-in for Unity 3D

Postby jay3d » Tue Jul 28, 2015 8:56 am

Update:

Implemented static mesh collision right from Unity mesh.

https://www.youtube.com/watch?v=6O8_WX88QnI

Watch it in 60fps for better viewing
jay3d
 
Posts: 33
Joined: Sun Jul 13, 2008 11:51 am

Re: Newton plug-in for Unity 3D

Postby Julio Jerez » Tue Jul 28, 2015 10:16 am

Ja, ja, ja. :mrgreen:
Oh man you are no getting spoiled by newton,
has you posted over the unity forum? be prepared for the haters.
some people do not tale likely, that the newton engine can performs as it does compare to competing tech that are support to be better but that really aren't. :D


jay3d wrote:I noticed that Mingw32 GCC gives higher performance than the DLL compiled with VS.

yes I know, and it is no by a small amount, it is a quite substantial difference. Newton in
GCC by far outperforme Newton in Visual studio, Cland, and Intel compiler.
My linux box is quiet all Pentium and I run faster that the PC with an I7 and the Max pro with Ceon I7
I test that a with back using Cwing and yes in the same PC and is I much faster.
I do not know for sure but I believe that for some reason this is with newton, but I do not know why.

I wish some one make a free plug in for GCC for visual studio.
Julio Jerez
Moderator
Moderator
 
Posts: 10718
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Newton plug-in for Unity 3D

Postby jay3d » Tue Jul 28, 2015 11:59 am

Thanks Julio!

I have a question regarding physics:

I want to implement a global scaling parameter in this plugin to compensate for processor floating point precision loss when simulating small objects less than 2 cm in dimensions, while keeping right and physically correct proportions. Which physical properties should be scaled?

For example i have a scene built with unit-less dimensions, 1 = 1
Newton default unit is meters so 1 unit = 1 meter in Newton, now I want to make 1 unit = 1 cm in Newton so I have to multiply physical properties by 100, so gravity will be scaled from 9.81 to 981,
other properties should be scaled accordingly AFAIK. I have scaled Mass and Density the same way, should I scale other properties as well?
jay3d
 
Posts: 33
Joined: Sun Jul 13, 2008 11:51 am

Re: Newton plug-in for Unity 3D

Postby Julio Jerez » Tue Jul 28, 2015 12:43 pm

It had come up several time, newton does not have global scale and the has caused some problems in the pass, I never added because I never considered a problem, but many big engines still use a different scale systems.
plus some none game engines simulate very small stuff that has problem with the engines internal tolerances.
For 3.14 I will add this two functions, how is that?
Code: Select all
dFloat NewtonGetGlobalScale (const NewtonWorld* const newtonWorld);
void NewtonSetGlobalScale (const NewtonWorld* const newtonWorld, dFloat scale);


then you do not have to worry about what and what not to scale. Ii is in fact more tricky than you may think.
Julio Jerez
Moderator
Moderator
 
Posts: 10718
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Newton plug-in for Unity 3D

Postby jay3d » Tue Jul 28, 2015 12:48 pm

Wow, thanks a lot Julio!

Looking forward for this addition :mrgreen:
jay3d
 
Posts: 33
Joined: Sun Jul 13, 2008 11:51 am

Re: Newton plug-in for Unity 3D

Postby JoeJ » Tue Jul 28, 2015 1:04 pm

jay3d wrote:I want to implement a global scaling parameter


I wanted the same a while ago but it was not as easy as i initially thought.
Some facts i've learned:

Scaling size does not mean you have to scale mass too - they are independent.
If you scale mass equally for all bodies, simulation does not change.
I think that the best 'scale' or unit for mass is so that forces have good floating point precision, but i did not do any tests yet.

There are some pitfalls about this:
Some joints have hard coded pin lengh (#define MIN_JOINT_PIN_LENGTH)
This keeps constant even when you scale size and the whole thing becomes more difficult.
(It affects joint max friction (== max force) for some joints)

There may be other issues...

If you get it working it would be nice if you post your findings - it seems a good question without a good answer so far.

... wrote this before Julios answer.
User avatar
JoeJ
 
Posts: 1147
Joined: Tue Dec 21, 2010 6:18 pm

Re: Newton plug-in for Unity 3D

Postby Julio Jerez » Tue Jul 28, 2015 1:34 pm

yes like Joe said these are part of issues with the scale.

In par the hard code contacts, in part the engine internal tolerances, and on the use size the stat for apply scale to thing they should not.
This is why is has to be a engine functionality

one think motivates me is that I am in a project that I can no speak now, but the simulate extremity tiny objects, some are even milliners in size, and the has big problem with problems tolerances.

so in this case a global scale will make the world larger the influence of the tolerance is negligible
even I the system is still mks.
this is a way overdoes feature. I expect few bugs at first because it touches a lots of stuff.
Julio Jerez
Moderator
Moderator
 
Posts: 10718
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles


Return to User Gallery

Who is online

Users browsing this forum: No registered users and 1 guest