TreeCollision taken into account the smoothed normals?

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

TreeCollision taken into account the smoothed normals?

Postby ruslannow » Sat May 29, 2010 9:41 am

Hi all
sorry for my english
please explain to me
the object TreeCollision taken into account the smoothed normals?
I was faced with the fact that the primitives in the calculation of collisions with TreeCollision, behave unstable.
Materials used standard.
NewtonMaterialSetDefaultFriction (pNewtonPhysicsWorld, 0, 0, 0.9f, 0.5);
NewtonMaterialSetDefaultElasticity (pNewtonPhysicsWorld, 0, 0, 0.2f);

Objects suddenly bounce, flip, Rolling ..
Please help solve the problem ..
Image
http://www.valar.ru/upload/jpg/0510/tre ... normal.htm

Image
http://www.valar.ru/upload/jpg/0510/scale_scene.htm
User avatar
ruslannow
 
Posts: 13
Joined: Fri May 28, 2010 1:09 pm
Location: Ukraine

Re: TreeCollision taken into account the smoothed normals?

Postby Julio Jerez » Sat May 29, 2010 11:16 am

the normal at a shared edge are smoothed for all collsion shapes wit the expetion fo teh suer collision.

what do you mean behave unstable? I do not undestant what the images means.

also if you are using a terrain for a tree collision maybe consider a Heighfield.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: TreeCollision taken into account the smoothed normals?

Postby ruslannow » Sat May 29, 2010 1:39 pm

Hope for a show that I had in mind.
http://www.youtube.com/watch?v=N4N5FDEYPIk

the normal at a shared edge are smoothed for all collsion shapes wit the expetion fo teh suer collision.

sorry, I'm even with the interpreter did not understand what is written here .. :oops:
User avatar
ruslannow
 
Posts: 13
Joined: Fri May 28, 2010 1:09 pm
Location: Ukraine

Re: TreeCollision taken into account the smoothed normals?

Postby Julio Jerez » Sat May 29, 2010 2:11 pm

I said that yes normals are smoothe in collison tree.

Oh I see, How are you moving the the objects, that does not looks right

can you send me a Test so that I can see what is wrong?

If you decide it to send me a test, try reproducing it with one only object.
It is easiere to debug that way.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: TreeCollision taken into account the smoothed normals?

Postby ruslannow » Sat May 29, 2010 2:54 pm

advance thank you very much!
http://depositfiles.com/ru/files/9k6i4getw
User avatar
ruslannow
 
Posts: 13
Joined: Fri May 28, 2010 1:09 pm
Location: Ukraine

Re: TreeCollision taken into account the smoothed normals?

Postby Julio Jerez » Sat May 29, 2010 4:45 pm

When I run ShadowMap.exe I get the error
Could not open file .lwo
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: TreeCollision taken into account the smoothed normals?

Postby ruslannow » Sat May 29, 2010 4:55 pm

Please excuse my carelessness ..
Put this file in the root of D:
http://depositfiles.com/ru/files/7862m0yrp

spacebar - to use force
User avatar
ruslannow
 
Posts: 13
Joined: Fri May 28, 2010 1:09 pm
Location: Ukraine

Re: TreeCollision taken into account the smoothed normals?

Postby Julio Jerez » Sat May 29, 2010 5:48 pm

I copied the fiel in eacg sub directory and still does get th same crash.

Put the demo together again, make sure it runs and then load a single zip file to ftp again.
I do not have time to guess what I need to do to make a demo run.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: TreeCollision taken into account the smoothed normals?

Postby ruslannow » Sat May 29, 2010 6:24 pm

User avatar
ruslannow
 
Posts: 13
Joined: Fri May 28, 2010 1:09 pm
Location: Ukraine

Re: TreeCollision taken into account the smoothed normals?

Postby Julio Jerez » Sat May 29, 2010 7:19 pm

Ok I have it now, I can see that there are some thing very, very wrong.
when I hit the space bar the box jumps in a very bad way.
I also see there are spheres but the do not roll at all, why is that?

Also when I hit the space bar, are you adding an impule, a force or are you changing the positions.
anyway, I will see what the problem is, but I am almost 100% it is not bad normal, more some bad set up.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: TreeCollision taken into account the smoothed normals?

Postby ruslannow » Sat May 29, 2010 7:33 pm

Thank you.
Pressing the space bar, the sign of gravity reversed.
Objects in the random initialization has weight.

Here are the settings:

pNewtonPhysicsWorld = NewtonCreate ();
NewtonSetSolverModel (pNewtonPhysicsWorld, 1);

D3DXVECTOR3 NewtonWorldMin=D3DXVECTOR3(-5000.0f,-5000.0f,-5000.0f);
D3DXVECTOR3 NewtonWorldMax=D3DXVECTOR3(5000.0f,5000.0f,5000.0f);
NewtonSetWorldSize (pNewtonPhysicsWorld, &NewtonWorldMin.x, &NewtonWorldMax.x);

NewtonMaterialSetDefaultFriction( pNewtonPhysicsWorld, 0, 0, 0.9f, 0.5);
NewtonMaterialSetDefaultElasticity(pNewtonPhysicsWorld, 0, 0, 0.2f);

NewtonBodySetForceAndTorqueCallback(npObjectCylinder[i].pN_RigidBody, PhysicsApplyForceAndTorque);
User avatar
ruslannow
 
Posts: 13
Joined: Fri May 28, 2010 1:09 pm
Location: Ukraine

Re: TreeCollision taken into account the smoothed normals?

Postby Julio Jerez » Sat May 29, 2010 8:41 pm

Ok I found the Bug, you are setting the Inertia matrix of each body to zero.

That makes the body spins very unrealistically, because if a body with zero resistance to spin any amoundt of torque from teh solver traslate to a very high angular velocity.
I am surprised it did not just blew up right away, the solver is so good that it always calculated force that amount to zero torque when the body is on flat ground,
but when the contact normal are not parallel, then the net torque is not zero and that give the body a high velocity.
It did not blow up because the integrator in Newton does not allow bodies spin faster than one half of a turn in one frame.
I looked at your file NewtonPhysics.cpp and I found the place where you create the body.
I added this modification

Code: Select all
   // Julio made this modification to make sure body have correct inertia
   if (N_Mass > 0.0f) {
      NewtonCollision* shape = NewtonBodyGetCollision(pN_RigidBody);
      D3DXVECTOR3 inertia;
      D3DXVECTOR3 centerOfMass;
      NewtonConvexCollisionCalculateInertialMatrix (shape, &inertia.x, &centerOfMass.x);
      //NewtonBodySetMassMatrix (pN_RigidBody, N_Mass, N_VectorMassOffset.x, N_VectorMassOffset.y, N_VectorMassOffset.z);
      NewtonBodySetMassMatrix (pN_RigidBody, N_Mass, N_Mass * inertia.x, N_Mass * inertia.y, N_Mass * inertia.z);
      NewtonBodySetCentreOfMass(pN_RigidBody, &centerOfMass.x);
   }

With that change it seems to work fine now.

I also saw the you gravity is really, really high, but I am guessing you are doing something different than Earth Gravity system.
Just for the record I thonk you are using a metric system, and if that is correct a gravity of 40, it amost twice as high as a Jupiter Gravity, that’s too extreme.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: TreeCollision taken into account the smoothed normals?

Postby ruslannow » Sat May 29, 2010 9:01 pm

Thank you very much!
Without you I would not understand ..
Thanks!
User avatar
ruslannow
 
Posts: 13
Joined: Fri May 28, 2010 1:09 pm
Location: Ukraine


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 2 guests

cron