strange bounce between ball and ground

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

strange bounce between ball and ground

Postby granite109 » Tue Oct 11, 2011 3:56 am

I try to simulate a tennis ball, and I found a strange thing. When I increase the velocity in Y , the bounce of the ball is not increase smoothly.

I serve a ball with velocity {0.0, 2.1, 4.0}, it looks good, the ball hit the ground and bounce good.
but when change the velocity to {0.0, 2.2, 4.0}, the ball bounce much lower.
and change the velocity to {0.0, 2.3, 4.0}, it looks good again.

And I compare the velocity before ball hit ground and the velocity after ball bounce:
-----------------------before ---------------------after
vY :2.1------vY:-2.42,vZ:3.32-----------vY:2.13,vZ:3.31
vY :2.2------vY:-2.47,vZ:3.30 ----------vY:1.74,vZ:3.29
vY :2.3------vY:-2.56,vZ:3.27-----------vY:2.27,vZ:3.27

so, what cause the vY reduce so much in this case?

the parameter is below:
PHYSICS_UPDATE_FPS 200.0f
Softness 0.9
Elasticity 0.9
Static friction 0.4
Dynamic friction 0.3

serve position {0.0, 0.14, 0.0}

create ball code

Code: Select all
NewtonCollision* Collision;
m_fBallRadius = 0.020f;
Collision = NewtonCreateSphere(m_pPhysWorld, m_fBallRadius, m_fBallRadius, m_fBallRadius, m_iPhysBallID, NULL);

World  = GetIdentityMatrix();
World.m_posit.m_x = 0.0f;
World.m_posit.m_y = 2.00f;
World.m_posit.m_z = 1.0f;

m_pPhysBall = NewtonCreateBody(m_pPhysWorld, Collision, &World[0][0]);
NewtonBodySetAutoSleep(m_pPhysBall,1);

// keep the player always active
NewtonBodySetFreezeState(m_pPhysBall, 0); // 0 unfreeze
NewtonBodySetMaterialGroupID (m_pPhysBall, m_iPhysBallID);
NewtonConvexCollisionCalculateInertialMatrix(Collision, &Inertia.m_x, &Origin.m_x);
//We're done with the collision object, release it
NewtonReleaseCollision(m_pPhysWorld, Collision);
//Set the callback to handle gravity
NewtonBodySetForceAndTorqueCallback (m_pPhysBall, physicsApplyForceAndTorque);
//Set mass
float Mass = 50.00f;
NewtonBodySetMassMatrix(m_pPhysBall, Mass, Mass*Inertia.m_x, Mass*Inertia.m_y, Mass*Inertia.m_z);
NewtonBodySetCentreOfMass(m_pPhysBall, &Origin.m_x);
NewtonBodySetFreezeState(m_pPhysBall, 1);
granite109
 
Posts: 7
Joined: Thu Jul 01, 2010 2:42 am

Re: strange bounce between ball and ground

Postby Julio Jerez » Tue Oct 11, 2011 7:37 am

I am guessing the the collision penetration is caussing it. it is controll bu the softness make the softness 0 or a very small value

I guess that what happens in thst teh penetrion varies a lot and the softness is causing it. it this reproducible?
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: strange bounce between ball and ground

Postby granite109 » Tue Oct 11, 2011 9:28 pm

change the softness to 0 still bounce strange.

But I found I called NewtonBodySetContinuousCollisionMode(m_pPhysBall,1) to prevent the ball pass through the net.

So, I try change to NewtonBodySetContinuousCollisionMode(m_pPhysBall,0), the bounce look good now.

And, I try change the ground to NewtonBodySetContinuousCollisionMode(m_pPhysGround,1), the bounce back to strange.

Is this right?
granite109
 
Posts: 7
Joined: Thu Jul 01, 2010 2:42 am

Re: strange bounce between ball and ground

Postby Julio Jerez » Wed Oct 12, 2011 9:09 am

Ha that was goin to be my secund sugestion. to turn continue collion off.

continue collion is a castrofic remedy solution. CC is like the Chemotherapy of collision prcedure. you apply when some is terribly wrong and you want to save something,
but you do not wnat to apply if there is a chance to remidy the problem by any other ways.

basically continues collision do the same when two body are in a realy deep penetrating state if they take a timestep,
the CC divide the time stepe into a numbe of sub steps with a smaller lenght than the haft diameter of the smaller of the colliding bodies.
then applying collision shape struction take the these smalled substeps ontil that islan until the islant hit the contact, then it trow away the rest fo the steps,
so contunues collision may lose energy, and I beleiev that si waht happen in your test.

this is ok for games when acuracy is not important but for a simulation is is always better to use a higher FPS than continue collision.

my suggetion si that you use both set CC on but use 500 fps. that way the CC is like a catastrofy insurance, by for the 99.99 of all cases the descretee collision will be used.
Julio Jerez
Moderator
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 1 guest

cron