Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Objects fall through ConcaveMeshShape #51

Closed
andreasdr opened this issue May 24, 2018 · 30 comments
Closed

Objects fall through ConcaveMeshShape #51

andreasdr opened this issue May 24, 2018 · 30 comments
Assignees
Labels

Comments

@andreasdr
Copy link

andreasdr commented May 24, 2018

HI,

sometimes in like 2/8 cases objects fall through ConcaveMeshShape.
In my case the bounding volumes are just BoxShapes.

I have an example video where you can see the issue:

I can provide another video if interested.

Many thanx and

Best regards
Andreas

@DanielChappuis
Copy link
Owner

When you create the TriangleVertexArray for your concave mesh, are you using the constructor to specify your surface normals or are you letting ReactPhysics3D compute the normals ?

@andreasdr
Copy link
Author

Hi,

I am not passing triangle/surface normals.

I also see ConvexMeshes falling through BoxShapes.

Its not super urgent. I will review my ConvexMeshShape generation again. And I will make a video to demonstrate the issues soon.

Best regards
Andreas

@DanielChappuis
Copy link
Owner

ConvexMesh and BoxShape use the same algorithm to collide against a ConcaveMeshShape. Therefore, it makes sense that you observe issues with both objects if something is wrong.

Are you able to produce a simple piece of code with a very simple ConcaveMeshShape and a BoxShape falling througth it ? It would be very helpful for debugging.

@DanielChappuis DanielChappuis self-assigned this May 28, 2018
@andreasdr
Copy link
Author

Ill do. Give me 1, max 2 days.

@DanielChappuis
Copy link
Owner

Great. Thanks a lot for your help !

@andreasdr
Copy link
Author

I need some more time but will provide a test soon.

@andreasdr
Copy link
Author

andreasdr commented May 31, 2018

Hi,

I have created a test that shows the issue. I am not sure if this covers all issues I have seen. But its a issue still. Hope you do not mind that its written in TDME2.
Just checkout TDME2 and switch to reactphysics3d-current branch.

You can build with "make clean && make -jHARDWARETHREADS mains"
You can issue the test from TDME2 folder with "./bin/tdme/tests/PhysicsTest4"

See:

Please keep me updated!

Best regards
Andreas

@DanielChappuis
Copy link
Owner

Hello,

After investigation, I think that in your example this is due to the fact that ReactPhysics3D uses discrete collision detection. What we observe is tunneling of shapes inside each other. In a given frame t the box is above the terrain and in the next frame t+1 the box is already bellow the terrain but there was no frame where the box was colliding with the terrain and therefore the collision has been missed.

I have plan to add continuous collision detection in the future but probably not in the next release. The idea is to compute when the two shapes will collide so that we don't miss the collision.

What you might try is to make sure that the collision shapes are not too small and also that their velocities when they collide to each other are not too large so that we do not miss the collision.

@andreasdr
Copy link
Author

Hi,

What you might try is to make sure that the collision shapes are not too small and also that their velocities when they collide to each other are not too large so that we do not miss the collision.

If its just that we will find a work around! I will check that.

Thank you.

Best regards
Andreas

@andreasdr
Copy link
Author

andreasdr commented Jun 6, 2018

But no. To be honest I do not think so. In my physics tests 1-3 you can see the issue as well with larger objects and moving more slowly. Maybe I can provide a test with bigger bounding volumes?

I will double check.

@DanielChappuis
Copy link
Owner

Ok I will check your physics test 1-3

@andreasdr
Copy link
Author

Just move the boxes or convex meshes in PhysicsTest1+3. The issue I mean happens from time to time.
E.g. a convex mesh sinks into ground and gets pushed 250ms later out of it. This is only looking strange. Sometimes it falls through too. I can try to set up a test with larger BVs.

Many thanx.

Best regards
Andreas

@DanielChappuis
Copy link
Owner

Can I ask you some questions about your physics tests in the "reactphysics3d-current" branch ?

When I run the PhysicsTest1, almost immediately, all the objects disappear. Are all the objects are falling through the ground ?

In the PhysicsTest2, I see boxes falling through boxes. Do you also have this behavior on your side ?

In the PhysicsTest3. Do you know why the objects have very strange behavior ? I mean jumping around everywhere ?

@andreasdr
Copy link
Author

Hi,

here everything is working 100%. I only have the issue that I show in PhysicsTest4.
Are you sure you have the latest version?

Best regards
Andreas

@andreasdr
Copy link
Author

I am on FreeBSD and MacOSX and sometimes I check Windows build too.

@andreasdr
Copy link
Author

andreasdr commented Jun 9, 2018

Hi,

see here:

Best regards
Andreas

@DanielChappuis
Copy link
Owner

On my side, I have this on Linux Mint (sorry for the flickering of the video):

https://www.dropbox.com/s/zskxy543hra44h6/tdme2-tests.mp4?dl=0

That's really strange.

@andreasdr
Copy link
Author

Hi,

I will check linux later. Do not use it that often.

I guess you are in virtualization? And Mint uses GCC right?

MacOSX has Clang as well as FBSD. So there might be a GCC issue.
I know some differences of GCC and Clang. Had issues before too. Will check.
Thank you for reporting.

Best regards
Andreas

@andreasdr
Copy link
Author

But your frame times indicate that you build via -g (debug build)
I switched to -O3 a while ago. Are you really sure you have the newest version???

@andreasdr
Copy link
Author

Hi,

Ok. Ive just tried TDME2-RP3D on my Ubuntu installation. I had have similar issues like you did. I read somewhere in your documentation that you use -O2 instead of -O3

I tried this and it seems to fix the issues. The issue with PhysicsTest4 remains.

Please tell me if this fixes your issues on your Linux Mint installation.

I will commit -O2 for now.

Best regards
Andreas

@DanielChappuis
Copy link
Owner

Ok thanks it's much better now with the -O2 option. I will continue investigating the issue.

@DanielChappuis
Copy link
Owner

I have been able to reproduce the issue in my testbed. I will now try to fix it.

@andreasdr
Copy link
Author

This is great news!!! Cant await the fix!

@andreasdr
Copy link
Author

Hi,

do not want to rush or something. I am just curious. Any news here?

Best regards
Andreas

@DanielChappuis
Copy link
Owner

Hello,

Yes, it took me some time but I think I have found a way to fix the issue yesterday. I will try to commit this fix this week-end after some more testing.

@andreasdr
Copy link
Author

If you provide me the fix as a patch or something I can help to test too.

@DanielChappuis
Copy link
Owner

I have pushed a fix with this commit into the "develop" branch. On my side, it fixes the BoxShape and ConvexMeshShape falling through ConcaveMeshShape and HeightFieldShape. It also fixes some jittering betweeen those shapes.

Could you test on your side if it is better now ?

@andreasdr
Copy link
Author

Hi, very nice. Will test tomorrow. Thanx a lot. I am super curious!

@andreasdr
Copy link
Author

PhysicsTest4 is fixed! And I am not able anymore to push convex meshes out of screen on PhysicsTest1 or 3! Seems like you fixed this bug!!!

The only thing that I see is that in my PhysicsTest4 the box has a small rotation around X or Z axis when idling on ground after beeing throwed, where as it maybe should not. Not a blocker. Not a big issue.

screenshot_2018-07-03_00-52-05

I will test much more the next days using our game!

@DanielChappuis
Copy link
Owner

Thanks a lot for your test and feedback. I have merged the fix into the "master" branch and I am closing this issue. About this small rotation, we will have to open another issue if necessary.

Thanks again for reporting the bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants