Dynamics changes

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Dynamics changes

Postby Cannos » Wed Jan 11, 2017 9:26 pm

I recently rebuilt Newton with the latest code and noticed that the dynamics/collision behavior was quite a bit different from the last version I built in September. I know there has been a lot of work on the solver and other parts of Newton, but didn't know if I should expect to see the big changes in behavior that I have.

Here's a video demonstrating some of the differences:
https://www.dropbox.com/s/90gltxwyltiriiw/newtoncompare.mp4?dl=0

  • The momentum change on collision of the bodies is very different. The new version is much stiffer with the sliding body losing almost all velocity on collision, and even moving backwards.
  • There's also some strange upward motion on the red disc at the end. It looks like some slow de-penetration, though there is no penetration.
  • Not shown in this video, I have seen some other bugs with bodies not sliding across each other as expected, and other strange rotation/movement when a body should be at rest against the ground.

Are these differences to be expected? If these are bugs, where's the best place for me to look at why this is happening? What is the most recent, stable version of Newton you recommend?
Cannos
 
Posts: 129
Joined: Thu Mar 04, 2010 5:41 pm

Re: Dynamics changes

Postby Julio Jerez » Wed Jan 11, 2017 10:22 pm

no non of that should be happening, if anything it should be behave much better.

is hard for me to see the difference in such short video.
do you have a test demo that links to the newton DLL so that I can check it out?
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Dynamics changes

Postby Cannos » Thu Jan 12, 2017 12:34 am

The main thing to pay attention to is the red disc in that video. It collides but continues forwards on the left side. On the right side, it bounced backwards upon collision and then slowly floats upwards.

I don't have a test demo that's easy to share. I'll try to put one together, and to also make more videos of other problems I see.
Cannos
 
Posts: 129
Joined: Thu Mar 04, 2010 5:41 pm

Re: Dynamics changes

Postby Dave Gravel » Thu Jan 12, 2017 8:12 pm

Sorry if it don't help you directly, and sorry about my english.
I get a little problem here too, I try to see if it have any relations.

My questions, the red and blue disc use joint ?
If yes do you apply force or something similar on this disc from inside the joint ?

Thanks.
You search a nice physics solution, if you can read this message you're at the good place :wink:
OrionX3D Projects & Demos:
https://orionx3d.sytes.net
https://www.facebook.com/dave.gravel1
https://www.youtube.com/user/EvadLevarg/videos
User avatar
Dave Gravel
 
Posts: 800
Joined: Sat Apr 01, 2006 9:31 pm
Location: Quebec in Canada.

Re: Dynamics changes

Postby Julio Jerez » Thu Jan 12, 2017 8:31 pm

let me get my pc ready, and then I will make sure the serialization works, that way you can serialize the scene few frames before the bug is about to happens, then you can load it in the sandbox demo and see if it can reproduce the bug, then I can debug it.

I am not sure if serialization is working after so many changes, so I let you know this weekend.
Cannos do you think you can do that.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Dynamics changes

Postby Julio Jerez » Thu Jan 12, 2017 9:08 pm

well try to play the game I do see a pop when a body hit the ground.
I committed that change, please tell me If this is related to what you guys are experiencing.
if you and just run the SDK you will see a falling box that pops in a weird way
when that box hi the ground is should bounce staring up once of twice without any rotations.

that has to be fixed for sure.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Dynamics changes

Postby Cannos » Thu Jan 12, 2017 10:08 pm

Dave: No I am not using any joints. I'm just setting the velocity on the body directly (NewtonBodySetVelocity).

Julio: Yes, I can try the serialization. I haven't used it before, but will try it once you say its working. For now I am just going to stick with the older version of Newton since it appears more stable on Windows and iOS in my case. Perhaps there is something strange I'm doing, or there are code changes I need to make to properly use the newer Newton, I'm not sure.

Here's another video showing problems:
https://www.dropbox.com/s/oby0b1xx5he0t1w/newtoncompare2.mp4?dl=0

You can see in the newer Newton, the red disc is bouncing backwards, then strangely rotating into the ground and hovering back out.
Cannos
 
Posts: 129
Joined: Thu Mar 04, 2010 5:41 pm

Re: Dynamics changes

Postby Julio Jerez » Fri Jan 13, 2017 6:57 pm

Ok I committed what I believe is a better solution to that bug, I run some test but I can no tell of will still happen n your side.

if you have time or you still have the 3.14 integration floating around
maybe you can sync and try again.

if still fail the you can try using this command to make a serialization of the scene.
Code: Select all
void NewtonSerializeToFile (const NewtonWorld* const newtonWorld, const char* const filename, NewtonOnBodySerializationCallback bodyCallback, void* const bodyUserData);


and then load the scene in the sandbox to see if it reproduce the bug.
I suggest that you implement is a way that create a time lap movie.

basically you make a name, and you append an ordinal value.

the in place where even happens, you call that function tp save a snap shot of the scene.
the bodies are save with their physic state, so it should recreate the bug.
the you just send me the file you think recreate best the bug.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Dynamics changes

Postby Cannos » Fri Jan 13, 2017 7:46 pm

Okay, if I get time this weekend, I'll give it a try.
Cannos
 
Posts: 129
Joined: Thu Mar 04, 2010 5:41 pm

Re: Dynamics changes

Postby Cannos » Mon Jan 16, 2017 4:11 am

Okay, I tried the latest code and still have issues. I serialized the scene but the playback in sandbox didn't look exactly like in my game. When replaying in the sandbox I did see a lot of asserts triggering that might be related.

The asserts were happening in these functions:
1) dgMeshEffect::RepairTJoints (I had to comment this out to run, these only hit in sandbox, not in my game)
2) dgWorldDynamicUpdate::CalculateClusterContacts (these happen in sandbox and my game)

Here's a comparison of the replay in my game (these videos look better if you download them instead of viewing in browser):
https://www.dropbox.com/s/l0780z59yxs055g/newtoncompare3.mp4?dl=0
Again, there's the strange rotation and floating of the red disc. But I'm also wondering about the collision response. In earlier Newton, the red disc doesn't bounce backwards, it continues forward, so it hasn't lost all of it's momentum. Is the new collision response expected?

Here's the serialized scene:
https://www.dropbox.com/s/26onxau07qadbj6/Newton-2017114-17481-225.bin?dl=0
Cannos
 
Posts: 129
Joined: Thu Mar 04, 2010 5:41 pm

Re: Dynamics changes

Postby Julio Jerez » Mon Jan 16, 2017 11:24 am

1) dgMeshEffect::RepairTJoints (I had to comment this out to run, these only hit in sandbox, not in my game)
2) dgWorldDynamicUpdate::CalculateClusterContacts (these happen in sandbox and my game)


these are important errors. the first one mean that you mesh has lot of collinear edges and T Joints that cause problem for the collision system. I changed the NewtonMesh Tool recently so let me finish that part first. It may be possible that you mesh was not repaired and in release model you do no get the asserts.
still that does no explain the jump back.

the second assert is more severe and should not be ignored, this most like means that some contact are pointing in opposite direction, and the solve can no find a solution.
I belie I fix that but I maybe have still a problem there.
I any case this is a good test case.

I will fist fix the fist problem so that we do no deal with geometry that we know can generate these problems.
the we see what is wrong with the second part.
but not the disk should not bounce back under any circumstance.

please keep this build around, we may have to do more than one test.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Dynamics changes

Postby Julio Jerez » Mon Jan 16, 2017 1:11 pm

Ha I now know what the problem is,
with the new collision system I commented out that continue collision.
This was because I am planning to make the CCD loop the official main loop when I add the tow pass solver.
however since I do no have it ready I will fix so that I work as it was before until I write the new solve mode.
thank for the repro, now I can fix it.

they is a way to get that going, but you are right it ha to work equal or better than before so I will fix it.
Please sync again when you have time to later again, I fixed the NewtonMesh, this is important for getting good contact form the mesh, you mesh has lot of collinear edges that are not good for collision.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Dynamics changes

Postby Cannos » Tue Jan 17, 2017 3:21 pm

Strangely, I never saw the RepairTJoints asserts in my game, even in debug mode. Perhaps this is because I'm calling NewtonTreeCollisionEndBuild() with optimize enabled, but that's just a guess.

I got the latest Newton changes. The results are better. It doesn't do the strange floating at the end, but it still does one small dip into the ground at 1.5 seconds in. It also still asserts in CalculateClusterContacts(), and it bounces backwards. Here is the video:

https://www.dropbox.com/s/2dna1pimkwc842s/newton4.mp4?dl=0
Cannos
 
Posts: 129
Joined: Thu Mar 04, 2010 5:41 pm

Re: Dynamics changes

Postby Julio Jerez » Tue Jan 17, 2017 4:36 pm

yes I will, I only fixed the mesh repair, the continue collision takes more work.
is not something I can do in an one or two hour seating in the morning.
I will do it this weekend and that should solve all the bugs you are seeing.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Dynamics changes

Postby Cannos » Tue Jan 17, 2017 8:05 pm

Great, thanks. Just let me know when you have fixes you want me to try out.
Cannos
 
Posts: 129
Joined: Thu Mar 04, 2010 5:41 pm


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 17 guests