A place to discuss everything related to Newton Dynamics.
Moderators: Sascha Willems, walaber
by Bird » Thu Oct 31, 2013 6:43 am
I'm trying to use the mouse to place bodies in the scene using NewtonWorldConvexCast() like in the Convex Cast demo and I've hit a problem with a simple mesh. Actually I think this is a problem in Newton Collision Tree rather than convex cast. I say that because if I set the hit body's shape to convex hull or a compound shape using convex decomposition then there's no problem.
Here's a video of what's happening.
http://hurleyworks.com/media/flash/StaticMeshProb/StaticMeshProb.htmlThe penetration happens only when the shape is a static mesh
Here's a the the OFF file of the ramp mesh.
http://hurleyworks.com/downloads/ramp.OFF-Bird
-
Bird
-
- Posts: 636
- Joined: Tue Nov 22, 2011 1:27 am
by Julio Jerez » Thu Oct 31, 2013 11:39 am
oh that look very bad.
so this test is like the convex cast demo but instead of using an array convex you put the ramp.
so if I place that ramp in the somewhere in the test, and I cast a box I should reproduced it?
I will try that and add some static mesh to the test.
-
Julio Jerez
- Moderator

-
- Posts: 12426
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by Bird » Thu Oct 31, 2013 11:53 am
so this test is like the convex cast demo but instead of using an array convex you put the ramp.
so if I place that ramp in the somewhere in the test, and I cast a box I should reproduced it?
That should work. One thing I noticed is that error seems to be dependent on the direction of the convex cast ... so if I rotate the camera to different view of the ramp, then *sometimes* there's no penetration or it shows up at a different place
I also tried dropping the box onto the ramp from above using the physics engine in order to give you a simple scene to diagnose but that worked perfectly .
-Bird
-
Bird
-
- Posts: 636
- Joined: Tue Nov 22, 2011 1:27 am
by Julio Jerez » Thu Oct 31, 2013 12:01 pm
Ha ok, let me modify the demo to have the set up and we find out what the problem is. I am guess that the same bug that I fixed yesterday is also duplicated on the polygon shape convex collision.
It can not be the collision tree, because ether collision tree is simple a database of vertices, indexes and normals. It does no do collision at all.
after that each face is converted into a polygon collision, and then call the convex/convex function to calculate the contacts.
however, the polygon collision shape is special because, and do so recalculation, an if some condition are meet, that it does no call the convex/convex collision instead resolve the contact calculation itself by
using simpler intersection routines. when I look at the video I see that the face and the Box meet those conditions, so I believe that where the bug is.
anyway let me set the scene and we will find out.
-
Julio Jerez
- Moderator

-
- Posts: 12426
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by Julio Jerez » Fri Nov 01, 2013 11:59 am
Ok I found the problem, I added a quick fix, but is not robust because.
basically I comment the function that trim the face around the cast, This show me when the bug is but because bring back that numerical instability problem that happen when a large shape and small shape are combined.
Please try again see if this is better,
Tomorrow I will add a better fix for that.
-
Julio Jerez
- Moderator

-
- Posts: 12426
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by Bird » Fri Nov 01, 2013 12:52 pm
Julio Jerez wrote:Ok I found the problem, I added a quick fix, but is not robust because.
basically I comment the function that trim the face around the cast, This show me when the bug is but because bring back that numerical instability problem that happen when a large shape and small shape are combined.
Please try again see if this is better,
Tomorrow I will add a better fix for that.
Definitely better. I tested with several scenes with static meshes and did not see any penetrations. In case you didn't know, m_normalOnHitPoint in NewtonWorldConvexCastReturnInfo never stores a valid normal ... it's always uninitialized.
Thanks for the quick fix!
-Bird
-
Bird
-
- Posts: 636
- Joined: Tue Nov 22, 2011 1:27 am
by Julio Jerez » Fri Nov 01, 2013 1:16 pm
Ok, I'w see why the normals are not saved and also made the proper fix tonight.
-
Julio Jerez
- Moderator

-
- Posts: 12426
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by Julio Jerez » Fri Nov 01, 2013 4:36 pm
I do not think it cast a compound shape.
I am suprice it sowrk at all, after I fix the bug I see what is going on there.
I see if i can make it to cast compund too, since they are considered convex shapes.
-
Julio Jerez
- Moderator

-
- Posts: 12426
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by Bird » Fri Nov 01, 2013 5:43 pm
Julio Jerez wrote:I do not think it cast a compound shape.
I am suprice it sowrk at all, after I fix the bug I see what is going on there.
I see if i can make it to cast compund too, since they are considered convex shapes.
Oh, your're right, casting a compound is not working at all. I was using raytracing first before using convex cast. It would be great if you can support casting compounds too. I'd like to switch from using raytracing to convex cast for painting now have it working in my project.
-Bird
-
Bird
-
- Posts: 636
- Joined: Tue Nov 22, 2011 1:27 am
by hamsterexplosion » Sat Nov 02, 2013 6:47 am
just tried to use rev 1192. does not solve my problem. sadly, still failing cylinder cast on dynamic bodies.
also new debug assertion fails added
- Attachments
-

- 1.jpg (43 KiB) Viewed 3932 times
-

hamsterexplosion
-
- Posts: 20
- Joined: Thu Jul 11, 2013 11:54 am
- Location: ukraine
by Julio Jerez » Sat Nov 02, 2013 12:15 pm
@ hamsterexplosion, those error are no related to the convex cast, not are memory leaks. you must have a different bug.
did you try the convex cast demo in the sand box, to see if the box was fixed. check that out and if it si fix them there must be a different problem.
But I do not know what you are doing so it is difficult for me to say anything. can you tell me the condition for how the cast is falling?
@ Bird, I checked in the correct fix, you can try again and see if it works.
Now I will see if I can add the convex cast on compound.
-
Julio Jerez
- Moderator

-
- Posts: 12426
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by Bird » Sat Nov 02, 2013 2:01 pm
Bird, I checked in the correct fix, you can try again and see if it works.
Now I will see if I can add the convex cast on compound.
It's working perfectly in the scenes I tried, including the original ramp scene.
Hope you can do compounds, that's a big deal for my project.
Thanks!
-Bird
-
Bird
-
- Posts: 636
- Joined: Tue Nov 22, 2011 1:27 am
by hamsterexplosion » Sat Nov 02, 2013 6:45 pm
Julio Jerez wrote:those error are no related to the convex cast, not are memory leaks.
than what is it and how to fight it? i had no such errors when using 3.11 build
Julio Jerez wrote:did you try the convex cast demo in the sand box, to see if the box was fixed.
i couldn't build the sandbox on my vs 2008, it doesn't support <type_traits>
Julio Jerez wrote:can you tell me the condition for how the cast is falling?
okay, i have a box (NewtonCreateBox), sized 30*0.0254 at each axis. i create NewtonCreateDynamicBody of it and cast a cylinder (r=16*0.0254, h=70*0.0254, oriented verticaly) downwards by Y axis. i'm suspicious that convex cast somehow mishandles the orientation of casted collision. not sure, but i couldn't reproduce it on non-oriented collision (with offsetMatrix set to identity)
-

hamsterexplosion
-
- Posts: 20
- Joined: Thu Jul 11, 2013 11:54 am
- Location: ukraine
by Julio Jerez » Sat Nov 02, 2013 9:03 pm
I am very surprise of what you are saying, because I use VS 2008 as my primary compiler, how will it build for me and not for you? does not make sense.
what type_traits?
How did you build before?
and can you download VS 2010?
I have not made any change that will cause a memory leak from version 3.11 to 3.12
I do not think the convex cast does not mishandle the orientation, it does is correctly. Most likely you are passing an incorrect orthonormal matrix.
this is a very trivial thing, to see if the bug is on your data, try casting a simpler shape shapes like a sphere, if the bug is there them is something you have wrong.
A numerical round error is very different than a systematic error like the one you are reporting, I have not seem it, and not one else has either with local shape matrices.
are you using non uniform scale?
-
Julio Jerez
- Moderator

-
- Posts: 12426
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
Return to General Discussion
Who is online
Users browsing this forum: No registered users and 0 guests