FaceAttribute and NewtonCollisionCollide

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Re: FaceAttribute and NewtonCollisionCollide

Postby Yezide » Wed Mar 21, 2012 2:20 pm

I think this stack of boxes shows it the best:

newton200:
http://youtu.be/vJanLe2vc0E

newton300:
http://youtu.be/hcaWTaG9RIg

It can also be seen when having a flat box and change the material settings a bit (showing that would take longer, so I skipped it for now, but tell me if the above videos are not enough and i will fix).
User avatar
Yezide
 
Posts: 173
Joined: Tue Oct 18, 2005 4:31 am

Re: FaceAttribute and NewtonCollisionCollide

Postby Julio Jerez » Wed Mar 21, 2012 2:28 pm

Ha Ok, are both set ups using the same material setting? also does teh fist scene work lie that wit teh latest newton200 or is this an older veideo?

can you tell me the box size, and spacing you use to create the scene. I can recreate a scene just like that an test it in both core 200 and 300.
better yet can you post the piece of code that creates that test scene.

I I can recrate the scene in both core 200 and 300 I should be able to find the error. the behevior should absolutely identical
I suspet this is the same bug that add the energy to the system.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: FaceAttribute and NewtonCollisionCollide

Postby Yezide » Wed Mar 21, 2012 2:36 pm

Same material settings between both yes (the default material)

This is the psuedo code for recreating:
Code: Select all
//Floor:
body = createboxbodywithsize(cVector3f(20,0.5f,20)
body.pos = Vec3(0,-0.25f, 0);
body.mass = 0;

//boxes:
for(int x=0; x<5;++x)
 for(int y=0; y<15;++y)
 {
   body = createboxbodywithsize(1,1,1);
   body.pos = Vec3(x*1.1-2,y*1.1+1,-2));
   body.mass = 0;
 }
User avatar
Yezide
 
Posts: 173
Joined: Tue Oct 18, 2005 4:31 am

Re: FaceAttribute and NewtonCollisionCollide

Postby Julio Jerez » Wed Mar 21, 2012 2:39 pm

how do you set the mass and the inertia?
is gravity -9.8?
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: FaceAttribute and NewtonCollisionCollide

Postby Yezide » Wed Mar 21, 2012 3:15 pm

gravity = -9.81f
timestep = 1.0f / 60.0f

mass and intertia:
Code: Select all
NewtonConvexCollisionCalculateInertialMatrix(pShapeNewton->GetNewtonCollision(),vInertia.v, vOffset.v);
vInertia = vInertia * afMass;
NewtonBodySetCentreOfMass(mpNewtonBody,vOffset.v);
NewtonBodySetMassMatrix(mpNewtonBody, afMass, vInertia.x, vInertia.y, vInertia.z);
User avatar
Yezide
 
Posts: 173
Joined: Tue Oct 18, 2005 4:31 am

Re: FaceAttribute and NewtonCollisionCollide

Postby Julio Jerez » Thu Mar 22, 2012 12:01 pm

ok I will try with those values and play side by side until I find teh bug, it should not be hard, it just takes time.

I fixed the ray cast bug reporting the sentinel body.

I am also completing the CollsionCollide, It is not completed yet because i did not populate a dommy material for the dummy contact joint.
I will complete that tonight, I do not want to duplicate the code that make a dummy for callback with normal bodies, basically I need to get that code fragment an convert it into an inline function.
the test demo is all ready and you can pick the shape and drag it until in touhes anothe body, when is does that it call ForAllBodies in and call collision collide on each one
the complete functionality sopdul be ready by tonight, I am late for work now.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: FaceAttribute and NewtonCollisionCollide

Postby Julio Jerez » Fri Mar 23, 2012 9:04 am

Ok CollisionCollide is there now.

In teh user ID I am passing teh sam evalue I was apssing in core 200, however teh will change, there is an incositence in teh engine that it is time that we change.

bascially in the beginnining we did no have multishape collsion shapes, anmd whe we added teh we try to do the best we could with the material ids,
but at the engine become more and more complex thet ieda of addin teh material ID to the rigid body become very limiting.

I am thonk to move the materail ID of to teh colliosion instance, this since a more apropriate way to deal with IDs.
it will unify the ID on the shape in a natural intefacem, as oppse to what it is now.

this is what the contact point structure looks like now

Code: Select all
class dgContactPoint
{
   public:
   dgVector m_point;
   dgVector m_normal;
   dgBody* m_body0;
   dgBody* m_body1;
   dgCollisionInstance* m_collision0;
   dgCollisionInstance* m_collision1;
   dgInt64 m_userId;
   dgFloat32 m_penetration;
   dgInt32 m_isEdgeContact;
   dgUnsigned16 m_deformableIndex0;
   dgUnsigned16 m_deformableIndex1;]
}

as you can see the there is room for only one ID, tah was beacsue the id is teh id onteh material, but mutishape collsion have a diffcutl time dealig with that, even harder is tow mutishape collision.
in the next build thre will be two ids, oen coming form each shape. and that will work well with teh intance base collision as well as with other funtionalities for collision shape liek trigger and gouth objects shapes in teh same shape..
anyway the collision collide function is there, nex I will debug the jiter problem.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: FaceAttribute and NewtonCollisionCollide

Postby Julio Jerez » Fri Mar 23, 2012 11:39 am

Oh wow, I state to debu the error and before that I try to ceck teh Box Tacking test in teh SDK, and you are right I introduceda big bug when adding the collison instance.

It is actaully good news because I know that some veriosn before the contact calculation was near perfect, so I should be able to find the error but comparing wih older version as oppost to comarion to core 200.
in fact all I have to do is stack two boxes to see the error, so even if I do no anythong to compare to it sod be eassy to fidn the box.

I checked the SDK lauching a simple stack of box and you can see that it show teh behavbior to are refering to.
Do not worrie is not a defiencey in teh engine, in fact to me thsi wodul be unaceptable.
this is simple a bug in teh contact calculation that will eb fixed..

I will fix this tomorrow.

edit:
ok I beleive I know what it is: the contact are intermitint, the calculaton of the AABB is the broadphase is so tight, the when a the bound of the the box is perfectly alighned with the a feature of a box,
the AABB reject that pair as not colliding, so the solver skip the body, the body fall a lithe and then teh new AABB do ovelat and a new pair is added,
the new contact have some pernetration so the solve try to separate then and the prossess keep repeation from frame to frame.
somewere I ignored the AABB padding on the calcution of the AABB and that si what cause that Bug. Nothong to worrie about.

I do not have time to fix it now, it will be tomorrow.

unfortunally thsi si no teh bug thaadd energy to the collsion in some case, but I can work on that after I fix this.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: FaceAttribute and NewtonCollisionCollide

Postby Yezide » Fri Mar 23, 2012 11:50 am

Oh goodie, then newton should be ready to use when I am finished with the new audio system :)
User avatar
Yezide
 
Posts: 173
Joined: Tue Oct 18, 2005 4:31 am

Re: FaceAttribute and NewtonCollisionCollide

Postby Julio Jerez » Sat Mar 24, 2012 2:04 pm

Ok when you sink to svn try yor test again, see if it work.

I thing that bug I fix was teh problem very sure that was the problem, bu I am no completelt sure becaus it looks like the teh bug was oen I added when adding teh collsion intacnce.

I di not use you scrip to mak eteh test, but I will do it next. I will make that oen of the test demos.
I am also not sure if this is the engrgy bug either, but now I have a good idea of what is causing it.

anyway after to try let me know what you get, meantime I will try to complete the core collision funtions, I have not look at the contineu collision yet.

I also added mo basi unit test, and they all since to pass. (some do no run yet because missing functionality).
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: FaceAttribute and NewtonCollisionCollide

Postby Yezide » Tue Mar 27, 2012 2:51 am

Engine is a bit of disarray now as I am updating the sound system, will try the new newton as soon as it is done!
User avatar
Yezide
 
Posts: 173
Joined: Tue Oct 18, 2005 4:31 am

Re: FaceAttribute and NewtonCollisionCollide

Postby Yezide » Fri Apr 13, 2012 2:05 am

Tried the latest version, and while the tower still topples over the collisions feel a lot less bouncy, so I think it is much better now.

I checked the code and seems like the serialization is not in yet. Any estimate for this? I think it is the last thing I need to be able to use newton300 for the game.
User avatar
Yezide
 
Posts: 173
Joined: Tue Oct 18, 2005 4:31 am

Re: FaceAttribute and NewtonCollisionCollide

Postby Julio Jerez » Fri Apr 13, 2012 8:10 am

I will add the sericalization over the weekend.
can you make the video again? The tower should state put. Coudl it be that teh restitition is some how different?

I beleive in core 200 was 0.4 but is core 300 is 0.6.
Please make the video so that I can have a rerference. Core 300 can no be any world than core 200 in any aspect, it can only be better.
so I will not rest untill Ithat is the case.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: FaceAttribute and NewtonCollisionCollide

Postby Yezide » Fri Apr 13, 2012 3:11 pm

For some reason I am not setting softness. It is present in both my older 200 version and new 300. Was this added later on? I made the material wrapper like 5 years ago :)

Anway, I am not setting that and it may be the problem. I tried setting it to values a bit lower than 1 in 200 and the tower of boxes become quite unstable, so that might be it! I do not have time to test with 300 right now, but will do over the weekend or first thing on monday!
User avatar
Yezide
 
Posts: 173
Joined: Tue Oct 18, 2005 4:31 am

Re: FaceAttribute and NewtonCollisionCollide

Postby Yezide » Sat Apr 14, 2012 12:57 am

I am setting up material combo defaults like this:
Code: Select all
NewtonMaterialSetDefaultSoftness(mpNewtonWorld,pMat0->mlMaterialId,pMat1->mlMaterialId, 0.1f);
NewtonMaterialSetDefaultElasticity(mpNewtonWorld,pMat0->mlMaterialId,pMat1->mlMaterialId, pMatCombo->mfElasticity);

NewtonMaterialSetDefaultFriction(mpNewtonWorld,pMat0->mlMaterialId,pMat1->mlMaterialId,   pMatCombo->mfStaticFriction, pMatCombo->mfKineticFriction);

#ifdef NEWTON_200
   NewtonMaterialSetContinuousCollisionMode(mpNewtonWorld,pMat0->mlMaterialId,pMat1->mlMaterialId, 1);
#endif


With this, the 200 test looks like the last video. Here is a video of the new 300:
http://youtu.be/1Na7ci4XPBg

Are there any more parameters for me to set up? Restitution is set up with NewtonMaterialSetDefaultElasticity right?
User avatar
Yezide
 
Posts: 173
Joined: Tue Oct 18, 2005 4:31 am

PreviousNext

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 2 guests