Newton Plugin for Unity 3D

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

Moderator: Alain

Re: Newton Plugin for Unity 3D

Postby walaber » Fri Jun 15, 2018 10:18 am

Hey guys-

sorry to post in an old thread, but I'm trying to find out the latest status of the Unity plugin. I see very recent commits in the git repo for the plugin so I'm assuming development is still active. has the discussion on the status of the plugin moved somewhere else?

I'm hoping to get back into using Newton for my independent games and Unity is my engine of choice these days so I'm trying to get up to speed and see what's possible now, and what is needed in order to create commercial games w/ Newton in Unity.
Independent game developer of (mostly) physics-based games. Creator of "JellyCar" and lead designer of "Where's My Water?"
User avatar
walaber
Moderator
Moderator
 
Posts: 393
Joined: Wed Mar 17, 2004 3:40 am
Location: California, USA

Re: Newton Plugin for Unity 3D

Postby Julio Jerez » Fri Jun 15, 2018 2:40 pm

hi Walaber,
The plugin is stable now, but it has not made much progress since no many people are using it, so there is not motivation to add new stuff.
I am working some final touches to 3.14 and then we will go over updating the plug in and add more functionality.

There are lot of new feature in the engine now and I have been focused more and more on physic simulation accuracy than performance.
Has you try it? if not, give it a try I am sure that with your talent there are lot of stuff that can be added.

also the engine is easy to extend, since it uses an automatic wrapper tool called Swig, is just a matter of adding the header to the script and then write a CSharp class to use the generated managed classes.
Julio Jerez
Moderator
Moderator
 
Posts: 10984
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Newton Plugin for Unity 3D

Postby walaber » Sat Jun 16, 2018 2:47 am

OK thanks Julio. I've built the plugin and it's working on my machine. I'll dig around and see how it goes.

I'm working on some gymnastics/acrobatics games concepts, and I'm running into some difficulty with the physics using PhysX. I want to try another physics system to help figure out how much of the trouble is the physics engine, and how much is what I'm specifically doing with it. I'm working on stuff like this:

Trapeze example


Gymnastics example
Twitter video of my work-in-progress game

It's been ages since I used Newton, so I'm going to have to remember how to do these things with Newton, but once I have some progress I'll start a new thread.

It's a powered ragdoll, with each joint being a "ConfigurableJoint" in PhysX/Unity terminology, using springs to try to reach a target orientation with a set strength and max force.
Independent game developer of (mostly) physics-based games. Creator of "JellyCar" and lead designer of "Where's My Water?"
User avatar
walaber
Moderator
Moderator
 
Posts: 393
Joined: Wed Mar 17, 2004 3:40 am
Location: California, USA

Re: Newton Plugin for Unity 3D

Postby Julio Jerez » Sat Jun 16, 2018 9:19 am

Oh nice, your video seem to be the perfect game to try one of the most unique feature on the engine.

to check it out please download the newton SDK and play the demo hexapod walker, so that you can see what I am talking about.
it is like little ant that can be manipulated with a reduced set of parameters.

My guess you are trying to map animation keyframe poses to the character and you are having some difficult time, this system in newton uses blend tree nodes to do full body inverse dynamics and integrate seemlessly with the physics.

please play the demo first so that you get an idea, and since you are familiar with animation and physics you can probably undertand how this can help you. basically it convert key frame poses to joint acceleration that are feed to the power ragdoll joints, and to be solve by the engine.
but this is a global controller rather that a one at a time power ragdoll system.

It has not been ported to Unity yet, but if you think it might interest you, please let us know.
and we can prioritize that feature, we where going to do it anyway, but we can do it first.
Julio Jerez
Moderator
Moderator
 
Posts: 10984
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Newton Plugin for Unity 3D

Postby walaber » Sat Jun 16, 2018 9:09 pm

OK I've started looking at the Unity plugin. Already I have a few questions:

1. It looks like the Unity NewtonWorld component is calling Update on the physics world once per frame, with the time elapsed since the last frame. But there are now parameters on the Newton World such as update rate and substep. So I'm assuming Newton is doing substepping for you, the correct # of fixed timesteps to match the elapsed time? I'm not sure though because changing the update rate to a higher number seems to slow down the physics, so perhaps it's not doing that? if so, wouldn't it make more sense to call the NewtonWorld Update() in FixedUpdate from Unity?

2. There are a ton of nice looking custom joints in the main newton project now, but there are still also the "built-in" joings like Hinge, BallAndSocket, etc. is there a specific preference these days for which ones to use?

I'll post more as I go, but one thing I've noticed is that you can't modify some values while the game is running. For example you can't currently change the world gravity in the NewtonWorld inspector while playing and see the changes. This is because that value is only passed to the Newton SDK on Start(). I've made a local change that calls on Start() but also in OnValidate() so that we canpass new values over to Newton while in Play mode, so you can adjust things while the game is running.

For now I'm testing this change on the NewtonWorld, but it would make sense to do this for Bodies and Joints as well, because tweaking things like Mass and joint settings while playing is really helpful when tweaking values.

Is there a preferred way to propose changes like this to the plugin? I'd like to try making a few test scenes for myself, and while I'm at it I'm happy to add some functionality to the plugin.
Independent game developer of (mostly) physics-based games. Creator of "JellyCar" and lead designer of "Where's My Water?"
User avatar
walaber
Moderator
Moderator
 
Posts: 393
Joined: Wed Mar 17, 2004 3:40 am
Location: California, USA

Re: Newton Plugin for Unity 3D

Postby Julio Jerez » Mon Jun 18, 2018 2:43 pm

I'd try to answer in no particular order.

Both Newton and the plugin are in GitHub, so is easy to submit pull request

In my case I am no very well verse in csharp, Sweeni is far more savvy that I, but I also believe neither of us are game designer, so we did the best we could.

The plugin uses a automatic wrapper tool to convert Newton to C#, so it is realizably easy to add the functionality. I say relatively because because although Swig is very powerful, newton use complex functionality of C++ the swig has a hard time converting, so for that the easy way we found to do the port is to write a simple C++ class that encapsuley the functionality we want and convert that instead.
the good knew is that there is a CNewton library that does ta already, the bad knew is that because is no used, is has to be revisited. I let you judge is that is good or bad.
The phsylosophy we seem to be using is that we part when we or some one request on demand. any contribution is welcome.

The joint on the core engine are legacy that are no use anymore, I have no remove then because hey use the same interface than other joints, so it will required some refactoring, by you are right I should remove the interface for the Newton.h file, it just has not been an issue.

The taking value at run time seem a cool idea, if you have a modification let us try the first patch.
If after you asset the plugin, if you decide to use it, we can give you commit assets of you plan big modification. we just need to make sure that modification aren't changes that are specific to one game.
Julio Jerez
Moderator
Moderator
 
Posts: 10984
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Newton Plugin for Unity 3D

Postby nothke » Fri Jan 11, 2019 9:47 am

Hey, I wanted to try this plugin, built it with the latest version of Newton, followed the guidelines, and got it working. I wanted to try it because I am interested in vehicle dynamics and looking alternatives to Unity's PhysX.

But it looks like the there are some missing scripts or broken things with vehicle demos. The motor object is missing some script in the "BoxCar" demo, and both "BasicVehicle" demos don't move at all, not even reporing any errors. I tried fixing it myself, but since I'm not familiar with how newton scripts work, and don't want to go deep into things that don't already work, I didn't get far.

I hope that the fact that the last message was posted in June last year doesn't mean it's dead :'(
nothke
 
Posts: 2
Joined: Mon Jan 07, 2019 4:07 pm

Re: Newton Plugin for Unity 3D

Postby Sweenie » Fri Jan 11, 2019 1:18 pm

The vehicle demos in the plugin stopped working after some changes in Newton and I didn't make any effort to try and fix them because a better vehicle system is on it's way. The vehicle demos in the plugin was pretty simple though and nothing compared to the new vehicle in Newton. I don't know the timeframe but we intend to add it to the plugin when it's in a more complete state in Newton.
Sweenie
 
Posts: 489
Joined: Mon Jan 24, 2005 7:59 am
Location: Sweden

Re: Newton Plugin for Unity 3D

Postby nothke » Sat Jan 12, 2019 8:50 am

Thanks for the reply! I see, I will keep an eye on the vehicle dynamics stuff on its thread. Hopefully not wait for too long.
nothke
 
Posts: 2
Joined: Mon Jan 07, 2019 4:07 pm

Previous

Return to User Gallery

Who is online

Users browsing this forum: No registered users and 1 guest