Newton objects penetration

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Newton objects penetration

Postby Cyrus » Mon May 17, 2010 1:13 am

Hi,
I am trying to use MogreNewt to create a sceneeditor kind of tool. I am using Ogrestudio (which has Newton 1.53) with Newton. I ran into the following issues -

1. A compound collision object placed on the floor (a mesh with Treecollision) penetrates through the floor if more than 1 items were stacked.
2. Most of my items(except the floor) have been created using compound collision created with convex hulls which were created by John Ratcliff's convex decomposition. An item falling down on another item sometimes pierces thru the items on the floor.
-> I tried adding material pair for the contactcallback between the 2 items. But the penetration remains.

3. An object placed on a floor takes a long time to settle down. i.e. takes a long time to come to a stable position from the initial position. Is this something to do with the NewtonUpdate timer/ticks?

Any clues/ideas/pointers to solve these queries is greatly appreciated.

Thanks in advance,
Cyrus
Cyrus
 
Posts: 49
Joined: Mon May 17, 2010 1:04 am

Re: Newton objects penetration

Postby JernejL » Mon May 17, 2010 3:29 am

Can you provide a video / demo app of the problem?

It looks, as if you have a floating point precision problem, how big are your objects?
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1587
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: Newton objects penetration

Postby Cyrus » Mon May 17, 2010 6:42 am

Hello Delfi
Please see the attached executable video along with the OBJ files which were used to create convex hulls for Compound Collision.
Please see the code below which creates the compound collision using collision array.

Code: Select all
           //objWFReader.GetHullList(strName) Reads the convex hull obj file and store in the list
            List<List<Vector3>> listHull = objWFReader.GetHullList(strName);
            MogreNewt.Collision[] cp = new MogreNewt.Collision[listHull.Count];
            for (int i = 0; i < listHull.Count; i++)
            {
                Vector3[] v3 = new Vector3[listHull[i].Count];
                for (int k = 0; k < listHull[i].Count; k++)
                {
                    v3[k] = listHull[i][k];
                }

                cp[i] = new MogreNewt.CollisionPrimitives.ConvexHull(m_World, v3, Quaternion.IDENTITY);
            }
            col[nn] = new MogreNewt.CollisionPrimitives.CompoundCollision(m_World, cp);
            bod[nn] = new MogreNewt.Body(m_World, col[nn]);
            col.Dispose();
           
      //This function reads all the "v" (vertices) lines from the obj files   
        public List<List<Vector3>> GetHullList(string filename)
        {
            int nCount = 0;
            int nn = 0;
            static bool bAdded = false;

            List<Vector3> listV3 = new List<Vector3>();
            List<List<Vector3>> listHull = new List<List<Vector3>>();
            FileStream fs;

            fs = new FileStream(filename, FileMode.Open);
            StreamReader sr = new StreamReader(fs);

            string line = "";
            do
            {
                line = sr.ReadLine();
                if (line != null)
                {
                    char chr = line[0];
                    if (chr == 'v')
                    {
                        string[] vec = line.Split(' ');
                        float vx = (float)Convert.ToDouble(vec[1]);
                        float vy = (float)Convert.ToDouble(vec[2]);
                        float vz = (float)Convert.ToDouble(vec[3]);
                        Vector3 v3 = new Vector3(vx, vy, vz);
                        listV3.Add(v3);
                        bAdded = false;
                    }
                    else
                    {
                        if (!bAdded)
                        {
                            listHull.Add(listV3);
                            listV3 = new List<Vector3>();
                            bAdded = true;
                        }
                    }
                }
            } while (line != null);
            sr.Close();
            fs.Close();
            return listHull;
        }   


Tray has 464 vertices, bottle has 859 and cup has 777 vertices
Attachments
video_objfiles_attached.zip
executable video file and obj (convex hull) files attached
(228.14 KiB) Downloaded 134 times
Cyrus
 
Posts: 49
Joined: Mon May 17, 2010 1:04 am

Re: Newton objects penetration

Postby Cyrus » Mon May 17, 2010 11:57 am

Hi,
Also, please let me know if there is any way to confirm if it is a floating point issue? and is there a work around for that issue?

Thanks in advance again
Cyrus
Cyrus
 
Posts: 49
Joined: Mon May 17, 2010 1:04 am

Re: Newton objects penetration

Postby JernejL » Mon May 17, 2010 1:17 pm

Floating point issue us just a guess, it could be anything like improperly set up materials, etc...

And forgive my paranoia, but i tend not to open videos ending with a .exe extension.
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1587
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: Newton objects penetration

Postby Julio Jerez » Mon May 17, 2010 1:52 pm

Cyrus wrote:Hi, ....
I am trying to use MogreNewt to create a sceneeditor kind of tool. I am using Ogrestudio (which has Newton 1.53) with Newton. I ran into the following issues -


Ok I checked out the video, but I could not figure out wheretteh video was at first I thought it was an EXE, but the I see it is a Video.
anyway, here are some issues.
compound collision support in 1.53 is not very good because there is not strategy for contact discrimination other than contact being too close.
This is especially true if the compound shape come for and automatic convex approximation tool because different pieces will must likely have shared edged that will generate very close contacts.
compound collision have being greatly improved in 2.00 for those reason.
They handle more shapes and much more stable. see thsi video of a Compound with more tan 6000 convex pieces.

The other point is if you are using OgreNewt, why do you use the latest Newton 2.00, and state with 1.53?
Even if I want to help it will be too hard to work on 1.53
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Newton objects penetration

Postby Cyrus » Tue May 18, 2010 11:56 pm

Thanks for the comments. I've upgraded to Newton 2 and the collision works if the downward velocity/force is small (equal to mass) i.e it does not pierce through the tray.
But if the force is set to 10*mass then the object pierces the tray and comes to rest at the lower bounds of the world.

Please let me know if I you can think of anything I can verify/check to find the cause of this behavior.

Thanks,
Cyrus
Cyrus
 
Posts: 49
Joined: Mon May 17, 2010 1:04 am

Re: Newton objects penetration

Postby Julio Jerez » Wed May 19, 2010 8:27 am

it should work as long as the forces are normal, 10 time the mass, is about a normal gravity force, that should be fine.

I do no know what could be, can you make a test for me to check?
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Newton objects penetration

Postby Cyrus » Wed May 19, 2010 11:42 am

By normal, do you mean the downward force should be perpendicular to the floor? Yes it is.

Can you please explain what kind of test do you want me to do?

Thanks,
Edison
Cyrus
 
Posts: 49
Joined: Mon May 17, 2010 1:04 am

Re: Newton objects penetration

Postby Julio Jerez » Wed May 19, 2010 11:57 am

an executable with the tray and the object that is supose to rest on it but faill to do so.
I must link to the newton DLL and run in windows mode.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Newton objects penetration

Postby Julio Jerez » Thu May 20, 2010 4:44 pm

one question, are you ruinng teh simulation at a fix step?
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Newton objects penetration

Postby Cyrus » Fri May 21, 2010 10:22 am

Hi,
Yes, It is running with step of 5. (m_World.Update(5f))

Thanks,
Cyrus
Cyrus
 
Posts: 49
Joined: Mon May 17, 2010 1:04 am

Re: Newton objects penetration

Postby Cyrus » Fri May 21, 2010 10:37 am

Please unzip & copy the attached dock.layout.zip to the Release folder and try launching again.
Thanks.
Attachments
dock.layout.zip
(1.91 KiB) Downloaded 137 times
Cyrus
 
Posts: 49
Joined: Mon May 17, 2010 1:04 am

Re: Newton objects penetration

Postby Julio Jerez » Fri May 21, 2010 11:02 am

now it crashes trying to read

Could not find file 'C:\temp\xxxxxxxx\exe\Release/IDE.xml'.

also I hope you do no mean update (5) and
update at 5 fps or evey 5 secunds.
becaus ethe will certally gurantee collison penetration.

Netwon take time in secunds, so you should be passing something like

update (1/100) for 100 for update
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Newton objects penetration

Postby Cyrus » Fri May 21, 2010 12:40 pm

Hi,
Terrific!!! Thanks for that. Now It drops in without penetrating.

I had one more query -
->When I move ( drag with mouse) an item and it collides another item, how can I prevent both items from penetrating each other and also reacting to the collision (moving away) i.e. it should stay put and not allow the other item to move beyond it.
I have uploaded a video to the same location I had mentioned earlier.

I have also attached the IDe.Xml

Thanks a million again
Attachments
IDE.zip
(257 Bytes) Downloaded 134 times
Last edited by Cyrus on Sat May 22, 2010 5:31 am, edited 1 time in total.
Cyrus
 
Posts: 49
Joined: Mon May 17, 2010 1:04 am

Next

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest