MADEAPPS / newton-dynamics

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

Assert In dgBroadPhase::AttachNewContact #174

Closed TrevorCash closed 4 years ago

TrevorCash commented 5 years ago

This assert only seems to come up when I have a cylinder object in the scene:

image

JulioJerez commented 5 years ago

that looks wrong, somehow a joint is twice in the list, that a big problem. there is nothing especial about cylinders. it is reproducible?

TrevorCash commented 5 years ago

I'll look into it further - weirdly - it is only happening when I attach a kinematics joint to the body. again it only happens when the body is a cylinder and does not happen when the body is a compound in my test case.

I have not changed my contact parsing code in a long time - but Its possible there is a bug there.

I just pushed my project up too. if I switch shapes to "gear_medium" shown in this code: image

(commit: be7fe45bee31d83b221c8809def7aaac653aff9d)

The assert happens consistently. In the game you have to pick up the object with left click though.

Like you say though I don't think its the shape. Because the NewtonPhysicsTests Demos work when you right click spawn the assortment of objects.

TrevorCash commented 5 years ago

Hi Julio,

I have been testing against various versions of newton the crash is always there - There are too many contacts.

Sometimes I get the crash in dgWorld::FlushCache(), the function tried to delete all contacts but the contactList.m_contactCount is still > 0 which causes an assert.

Other times I get a crash in dgBroadPhase::SanityCheck().

Both seem to be the same problem.

I have tried commenting out my NewtonProcessCantacts callback, the issue is still there. It only happens after I delete a body and create a new one. Could it be I need to manually destroy contacts in my code? So far I am letting newton handle it.

Thanks, Trevor

TrevorCash commented 5 years ago

After looking further it this behavioral only happens after the changes introduced between

newton commit: 6f7d3bf1b7ffc030fb3a6e2fa588c561b13ea338

and

newton commit: 2a50b8236f131ee9fd6cb906b2f0a8b5c3f2ad04

Which makes sense because of the changes in dgContact.

for now I am using commit: 2a50b8236f131ee9fd6cb906b2f0a8b5c3f2ad04

JulioJerez commented 5 years ago

I have not have time to check the error, but that last observation you made is a good clue to the reason of the bug. What happen is that I made a changed that replaced the contact list with a contact array, this is faster but it lose the ability to delete contact in constant time. So I added a flag the mark the contact dead. But there may be a bad bug with deleting a body yes, I will check this Saturday.

TrevorCash commented 5 years ago

Thanks a bunch!

JulioJerez commented 5 years ago

in preparation to check these bug I clone your project again and using cmake x64 with the default setting I only got one compile error left

1>------ Build started: Project: TechGame, Configuration: Debug x64 ------ 1>ManipulationTool.cpp 1>c:\users\jjerez.bsg\documents\github\techgame\techgame\ManipulationTool.h(2): fatal error C1083: Cannot open include file: 'Urho3D/Urho3DAll.h': No such file or directory 1>NodeTools.cpp 1>c:\users\jjerez.bsg\documents\github\techgame\techgame\NodeTools.h(2): fatal error C1083: Cannot open include file: 'Urho3D/Urho3DAll.h': No such file or directory 1>Generating Code... 1>Done building project "TechGame.vcxproj" -- FAILED. .... .... 2>------ Skipped Build: Project: INSTALL, Configuration: Debug x64 ------ 2>Project not selected to build for this solution configuration ========== Build: 0 succeeded, 1 failed, 61 up-to-date, 1 skipped ==========

do you know who to fix that? also does the code that is committed generates these bugs?

TrevorCash commented 5 years ago

Yeah just add this switch in cmake: -DURHO3D_MONOLITHIC_HEADER=ON

TrevorCash commented 5 years ago

That enables the Urho3D/Urho3DAll.h header file. (its an option because it is slower to compile with the combined header. I use it for prototyping games though)

TrevorCash commented 5 years ago

the full list of options I use is this:

-DURHO3D_CSHARP=OFF \
-DURHO3D_MONOLITHIC_HEADER=ON \
-DURHO3D_SAMPLES=ON \
-DURHO3D_WIN32_CONSOLE=ON \
-DURHO3D_WEBP=OFF \
-DURHO3D_NAVIGATION=OFF \
-DURHO3D_URHO2D=OFF \
-DURHO3D_NETWORK=OFF \
-DURHO3D_PROFILING=OFF \
-DNEWTON_WITH_AVX2_PLUGIN=ON \
-DNEWTON_DOUBLE_PRECISION=ON
JulioJerez commented 5 years ago

I have a litle time to try this again. I set the options like you said and I now get these errors that I never seen before.

9>Error HRESULT E_FAIL has been returned from a call to a COM component. 9>Error: Error HRESULT E_FAIL has been returned from a call to a COM component. 10>------ Build started: Project: Assimp, Configuration: Debug x64 ------ 10>Error HRESULT E_FAIL has been returned from a call to a COM component. 10>Error: Error HRESULT E_FAIL has been returned from a call to a COM component. 11>------ Build started: Project: crnlib, Configuration: Debug x64 ------ 11>Error HRESULT E_FAIL has been returned from a call to a COM component. 11>Error: Error HRESULT E_FAIL has been returned from a call to a COM component. 12>------ Build started: Project: crunch, Configuration: Debug x64 ------ 12>Error HRESULT E_FAIL has been returned from a call to a COM component. 12>Error: Error HRESULT E_FAIL has been returned from a call to a COM component. 13>------ Skipped Build: Project: INSTALL, Configuration: Debug x64 ------ 13>Project not selected to build for this solution configuration ========== Build: 0 succeeded, 12 failed, 74 up-to-date, 1 skipped

I type some lines in google and I get various opinion but not a definite answer as to what is it.

On Fri, Jul 19, 2019 at 11:41 AM Trevor Cash notifications@github.com wrote:

the full list of options I use is this:

-DURHO3D_CSHARP=OFF \ -DURHO3D_MONOLITHIC_HEADER=ON \ -DURHO3D_SAMPLES=ON \ -DURHO3D_WIN32_CONSOLE=ON \ -DURHO3D_WEBP=OFF \ -DURHO3D_NAVIGATION=OFF \ -DURHO3D_URHO2D=OFF \ -DURHO3D_NETWORK=OFF \ -DURHO3D_PROFILING=OFF \ -DNEWTON_WITH_AVX2_PLUGIN=ON \ -DNEWTON_DOUBLE_PRECISION=ON

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/MADEAPPS/newton-dynamics/issues/174?email_source=notifications&email_token=AB6EPJGAPHTWUCOYHEFRXJ3QAIDHNA5CNFSM4IEHCVP2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2MN66Q#issuecomment-513335162, or mute the thread https://github.com/notifications/unsubscribe-auth/AB6EPJCG2KDHXHO35G5UMPLQAIDHNANCNFSM4IEHCVPQ .

JulioJerez commented 5 years ago

I am using vs 2017 professional.

On Tue, Jul 23, 2019 at 11:22 AM Julio Jerez jerezjulio0@gmail.com wrote:

I have a litle time to try this again. I set the options like you said and I now get these errors that I never seen before.

9>Error HRESULT E_FAIL has been returned from a call to a COM component. 9>Error: Error HRESULT E_FAIL has been returned from a call to a COM component. 10>------ Build started: Project: Assimp, Configuration: Debug x64 ------ 10>Error HRESULT E_FAIL has been returned from a call to a COM component. 10>Error: Error HRESULT E_FAIL has been returned from a call to a COM component. 11>------ Build started: Project: crnlib, Configuration: Debug x64 ------ 11>Error HRESULT E_FAIL has been returned from a call to a COM component. 11>Error: Error HRESULT E_FAIL has been returned from a call to a COM component. 12>------ Build started: Project: crunch, Configuration: Debug x64 ------ 12>Error HRESULT E_FAIL has been returned from a call to a COM component. 12>Error: Error HRESULT E_FAIL has been returned from a call to a COM component. 13>------ Skipped Build: Project: INSTALL, Configuration: Debug x64 ------ 13>Project not selected to build for this solution configuration ========== Build: 0 succeeded, 12 failed, 74 up-to-date, 1 skipped

I type some lines in google and I get various opinion but not a definite answer as to what is it.

On Fri, Jul 19, 2019 at 11:41 AM Trevor Cash notifications@github.com wrote:

the full list of options I use is this:

-DURHO3D_CSHARP=OFF \ -DURHO3D_MONOLITHIC_HEADER=ON \ -DURHO3D_SAMPLES=ON \ -DURHO3D_WIN32_CONSOLE=ON \ -DURHO3D_WEBP=OFF \ -DURHO3D_NAVIGATION=OFF \ -DURHO3D_URHO2D=OFF \ -DURHO3D_NETWORK=OFF \ -DURHO3D_PROFILING=OFF \ -DNEWTON_WITH_AVX2_PLUGIN=ON \ -DNEWTON_DOUBLE_PRECISION=ON

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/MADEAPPS/newton-dynamics/issues/174?email_source=notifications&email_token=AB6EPJGAPHTWUCOYHEFRXJ3QAIDHNA5CNFSM4IEHCVP2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2MN66Q#issuecomment-513335162, or mute the thread https://github.com/notifications/unsubscribe-auth/AB6EPJCG2KDHXHO35G5UMPLQAIDHNANCNFSM4IEHCVPQ .

TrevorCash commented 5 years ago

hmm. Can you try building just rbfx? You can run cmake inside the rbfx folder and make a build directory inside that. just to make sure the base game engine builds. you can use default cmake parameters. the Urho3d project should build

Get Outlook for Androidhttps://aka.ms/ghei36


From: NewtonDynamics notifications@github.com Sent: Tuesday, July 23, 2019 12:17:19 PM To: MADEAPPS/newton-dynamics newton-dynamics@noreply.github.com Cc: Trevor Cash cashtrevor@msn.com; Author author@noreply.github.com Subject: Re: [MADEAPPS/newton-dynamics] Assert In dgBroadPhase::AttachNewContact (#174)

I am using vs 2017 professional.

On Tue, Jul 23, 2019 at 11:22 AM Julio Jerez jerezjulio0@gmail.com wrote:

I have a litle time to try this again. I set the options like you said and I now get these errors that I never seen before.

9>Error HRESULT E_FAIL has been returned from a call to a COM component. 9>Error: Error HRESULT E_FAIL has been returned from a call to a COM component. 10>------ Build started: Project: Assimp, Configuration: Debug x64 ------ 10>Error HRESULT E_FAIL has been returned from a call to a COM component. 10>Error: Error HRESULT E_FAIL has been returned from a call to a COM component. 11>------ Build started: Project: crnlib, Configuration: Debug x64 ------ 11>Error HRESULT E_FAIL has been returned from a call to a COM component. 11>Error: Error HRESULT E_FAIL has been returned from a call to a COM component. 12>------ Build started: Project: crunch, Configuration: Debug x64 ------ 12>Error HRESULT E_FAIL has been returned from a call to a COM component. 12>Error: Error HRESULT E_FAIL has been returned from a call to a COM component. 13>------ Skipped Build: Project: INSTALL, Configuration: Debug x64 ------ 13>Project not selected to build for this solution configuration ========== Build: 0 succeeded, 12 failed, 74 up-to-date, 1 skipped

I type some lines in google and I get various opinion but not a definite answer as to what is it.

On Fri, Jul 19, 2019 at 11:41 AM Trevor Cash notifications@github.com wrote:

the full list of options I use is this:

-DURHO3D_CSHARP=OFF \ -DURHO3D_MONOLITHIC_HEADER=ON \ -DURHO3D_SAMPLES=ON \ -DURHO3D_WIN32_CONSOLE=ON \ -DURHO3D_WEBP=OFF \ -DURHO3D_NAVIGATION=OFF \ -DURHO3D_URHO2D=OFF \ -DURHO3D_NETWORK=OFF \ -DURHO3D_PROFILING=OFF \ -DNEWTON_WITH_AVX2_PLUGIN=ON \ -DNEWTON_DOUBLE_PRECISION=ON

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/MADEAPPS/newton-dynamics/issues/174?email_source=notifications&email_token=AB6EPJGAPHTWUCOYHEFRXJ3QAIDHNA5CNFSM4IEHCVP2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2MN66Q#issuecomment-513335162, or mute the thread https://github.com/notifications/unsubscribe-auth/AB6EPJCG2KDHXHO35G5UMPLQAIDHNANCNFSM4IEHCVPQ .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/MADEAPPS/newton-dynamics/issues/174?email_source=notifications&email_token=AATQ3C45GKHXTF6MPTKYPETQA5DK7A5CNFSM4IEHCVP2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2T7ROQ#issuecomment-514324666, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AATQ3C7Q5Y25OG6C4RURFMLQA5DK7ANCNFSM4IEHCVPQ.

JulioJerez commented 5 years ago

for completion I try generating a visual studio 2015 solution but does not compile at all because I believe it uses cpp features not available in vs 2015. or maybe something else. by the errors are too many

17>C:\Users\jjerez.BSG\Documents\GitHub\TechGame\rbfx\Source\Tools\Editor\Pipeline\Pipeline.cpp(160): error C3538: in a declarator-list 'auto' must always deduce to the same type

On Tue, Jul 23, 2019 at 11:23 AM Julio Jerez jerezjulio0@gmail.com wrote:

I am using vs 2017 professional.

On Tue, Jul 23, 2019 at 11:22 AM Julio Jerez jerezjulio0@gmail.com wrote:

I have a litle time to try this again. I set the options like you said and I now get these errors that I never seen before.

9>Error HRESULT E_FAIL has been returned from a call to a COM component. 9>Error: Error HRESULT E_FAIL has been returned from a call to a COM component. 10>------ Build started: Project: Assimp, Configuration: Debug x64 ------ 10>Error HRESULT E_FAIL has been returned from a call to a COM component. 10>Error: Error HRESULT E_FAIL has been returned from a call to a COM component. 11>------ Build started: Project: crnlib, Configuration: Debug x64 ------ 11>Error HRESULT E_FAIL has been returned from a call to a COM component. 11>Error: Error HRESULT E_FAIL has been returned from a call to a COM component. 12>------ Build started: Project: crunch, Configuration: Debug x64 ------ 12>Error HRESULT E_FAIL has been returned from a call to a COM component. 12>Error: Error HRESULT E_FAIL has been returned from a call to a COM component. 13>------ Skipped Build: Project: INSTALL, Configuration: Debug x64 ------ 13>Project not selected to build for this solution configuration ========== Build: 0 succeeded, 12 failed, 74 up-to-date, 1 skipped

I type some lines in google and I get various opinion but not a definite answer as to what is it.

On Fri, Jul 19, 2019 at 11:41 AM Trevor Cash notifications@github.com wrote:

the full list of options I use is this:

-DURHO3D_CSHARP=OFF \ -DURHO3D_MONOLITHIC_HEADER=ON \ -DURHO3D_SAMPLES=ON \ -DURHO3D_WIN32_CONSOLE=ON \ -DURHO3D_WEBP=OFF \ -DURHO3D_NAVIGATION=OFF \ -DURHO3D_URHO2D=OFF \ -DURHO3D_NETWORK=OFF \ -DURHO3D_PROFILING=OFF \ -DNEWTON_WITH_AVX2_PLUGIN=ON \ -DNEWTON_DOUBLE_PRECISION=ON

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/MADEAPPS/newton-dynamics/issues/174?email_source=notifications&email_token=AB6EPJGAPHTWUCOYHEFRXJ3QAIDHNA5CNFSM4IEHCVP2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2MN66Q#issuecomment-513335162, or mute the thread https://github.com/notifications/unsubscribe-auth/AB6EPJCG2KDHXHO35G5UMPLQAIDHNANCNFSM4IEHCVPQ .

JulioJerez commented 5 years ago

when I do that it does compile yes. some warnings but I see the in many other projects too. I guess the rbtx is the core urtho project engine because I do not see any of the newton or the TexcGame projects.

TrevorCash commented 5 years ago

Yes rbfx is a newer version of the Urho3D project. the TechGame project has rbfx as one of the submodules, as well as other plugins like rbfx-newton, etc..

rbfx uses c++17.

It is interesting you can build the rbfx project but not the entire TechGame project.

It could be a visual studio versioning problem: I am using vs 2017 15.9.7.

also I am using cmake 3.12 but I dont think thats the problem.

TrevorCash commented 5 years ago

if you want you can also test just the rbfx-newton plugin by making a folder structure like this:

MyTestSolution ->rbfx/... ->rbfx-newton/... ->CMakeLists.txt

then the resulting solution will have rbfx and rbfx-newton.

Thats the same pattern TechGame uses.

JulioJerez commented 5 years ago

I suspect too this is a versioning shit from some sequrity nonsense. I tryied o do this in me lunch time from work, But I can try tonight at home with the free version of vs 2017.

TrevorCash commented 5 years ago

Yeah that might be it. I am using community vs 2017.

JulioJerez commented 5 years ago

I do not not get why getting this has been so hard, I try to clone again from home but I get a GitHub error, something like a sync point is missing, I can't get the exact error because giuthub does not let me copy from the screen, by if I ignore the error and try to create the solution, I get this cmake error.

CMake Error at CMakeLists.txt:14 (add_subdirectory): The source directory

D:/TechGame/rbfx-openvr

does not contain a CMakeLists.txt file.

TrevorCash commented 5 years ago

Hi Julio,

It looks like somehow that submodule is not fully initialized. if you checkout the Stable branch I just pushed to, all submodules should be in order.

Get Outlook for Androidhttps://aka.ms/ghei36


From: NewtonDynamics notifications@github.com Sent: Friday, July 26, 2019 8:38:29 AM To: MADEAPPS/newton-dynamics newton-dynamics@noreply.github.com Cc: Trevor Cash cashtrevor@msn.com; Author author@noreply.github.com Subject: Re: [MADEAPPS/newton-dynamics] Assert In dgBroadPhase::AttachNewContact (#174)

I do npt not get why thsi has been so hard to get, I try to clone again form home by I get a GitHub error, that a sync point is missing, I can get the exact error because giuthub does no let you copy form the screen, by if I ignore the error and try to create the solution I get this error from cmake.

CMake Error at CMakeLists.txt:14 (add_subdirectory): The source directory

D:/TechGame/rbfx-openvr

does not contain a CMakeLists.txt file.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/MADEAPPS/newton-dynamics/issues/174?email_source=notifications&email_token=AATQ3C5OXGBXUGKJ4GL3UPTQBMD6LA5CNFSM4IEHCVP2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD24ZRFI#issuecomment-515479701, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AATQ3C5LVCY42WOVMUOCQ3DQBMD6LANCNFSM4IEHCVPQ.

JulioJerez commented 5 years ago

this is what I see in teh github app..

C:\Users\jjerez.BSG\Documents\GitHub\TechGame\rbfx C:\Users\jjerez.BSG\Documents\GitHub\TechGame\rbfx-newton C:\Users\jjerez.BSG\Documents\GitHub\TechGame\rbfx-openvr

@ -1 +1 @@ Subproject commit 9df35ac8d47cd1364831610eced4c38d96b8d86c Subproject commit da37977a6d21ac7af7a5a06600f03f24e271fe11 but is does not move pass that point even if I force to re clone.

you say this

if you checkout the Stable branch I just pushed to, all submodules should be in order.?

how do I do that?

TrevorCash commented 5 years ago

git checkout Stable git submodule init

of the top of my head.

Get Outlook for Androidhttps://aka.ms/ghei36


From: NewtonDynamics notifications@github.com Sent: Friday, July 26, 2019 12:03:58 PM To: MADEAPPS/newton-dynamics newton-dynamics@noreply.github.com Cc: Trevor Cash cashtrevor@msn.com; Author author@noreply.github.com Subject: Re: [MADEAPPS/newton-dynamics] Assert In dgBroadPhase::AttachNewContact (#174)

this is what I see in teh github app..

C:\Users\jjerez.BSG\Documents\GitHub\TechGame\rbfx C:\Users\jjerez.BSG\Documents\GitHub\TechGame\rbfx-newton C:\Users\jjerez.BSG\Documents\GitHub\TechGame\rbfx-openvr

@ -1 +1 @@ Subproject commit 9df35ac8d47cd1364831610eced4c38d96b8d86c Subproject commit da37977a6d21ac7af7a5a06600f03f24e271fe11 but is does not move pass that point even if I force to re clone.

if you checkout the Stable branch I just pushed to, all submodules should be in order.? how do I do that?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/MADEAPPS/newton-dynamics/issues/174?email_source=notifications&email_token=AATQ3CY2DK67O2RV3V4IDOTQBM4A5A5CNFSM4IEHCVP2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD25KAFI#issuecomment-515547157, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AATQ3C2LG4KI6VRKFOVJ6DLQBM4A5ANCNFSM4IEHCVPQ.

TrevorCash commented 5 years ago

Have you used a tool like GitKraken before? it makes working with submodules a little easier. all can be done with command line of course though.

Get Outlook for Androidhttps://aka.ms/ghei36


From: NewtonDynamics notifications@github.com Sent: Friday, July 26, 2019 12:03:58 PM To: MADEAPPS/newton-dynamics newton-dynamics@noreply.github.com Cc: Trevor Cash cashtrevor@msn.com; Author author@noreply.github.com Subject: Re: [MADEAPPS/newton-dynamics] Assert In dgBroadPhase::AttachNewContact (#174)

this is what I see in teh github app..

C:\Users\jjerez.BSG\Documents\GitHub\TechGame\rbfx C:\Users\jjerez.BSG\Documents\GitHub\TechGame\rbfx-newton C:\Users\jjerez.BSG\Documents\GitHub\TechGame\rbfx-openvr

@ -1 +1 @@ Subproject commit 9df35ac8d47cd1364831610eced4c38d96b8d86c Subproject commit da37977a6d21ac7af7a5a06600f03f24e271fe11 but is does not move pass that point even if I force to re clone.

if you checkout the Stable branch I just pushed to, all submodules should be in order.? how do I do that?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/MADEAPPS/newton-dynamics/issues/174?email_source=notifications&email_token=AATQ3CY2DK67O2RV3V4IDOTQBM4A5A5CNFSM4IEHCVP2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD25KAFI#issuecomment-515547157, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AATQ3C2LG4KI6VRKFOVJ6DLQBM4A5ANCNFSM4IEHCVPQ.

TrevorCash commented 5 years ago

From the root TechGame directory you can use: git submodule update --init --recursive if some submodules are not initialized https://stackoverflow.com/questions/10168449/git-update-submodules-recursively

JulioJerez commented 4 years ago

I believe this was fixed.