Terrain <-> Compound Collision World Scale Problem [SOLVED]

Report any bugs here and we'll post fixes

Moderators: Sascha Willems, Thomas

Re: Terrain <-> Compound Collision World Scale Problem

Postby Julio Jerez » Sat Oct 27, 2018 4:28 pm

Just for fun I added a stress test of 100 cars running in four thread asynchronous.
I get about 9 ms physics time and about 400 fps.
I would expect the physics time to be less time, by that is what we get.

The vehicle solve is no optimized it can be faster but I do no want to make too complex,
The way I it when the car is fully completed I expect to handle about 20 to 25 cars in single core.

if you can try it an tell me what you get.

for here is now adding the rest of the vehicle dynamics forces: engine and aerodynamics
and the controller, for now only steering and brakes.

ok now to fix some of the pending bug before moving on.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Terrain <-> Compound Collision World Scale Problem

Postby Julio Jerez » Sat Oct 27, 2018 5:06 pm

edit: I runner in debug and what a tire get more than one contact is generate a single matrix.
The will explode the car, running in release, I will fix that tomorrow.

here is where start to get complicated, basically when tire get multiple contacts, the engine nee to run a Eigen value decomposition to dine out which are the essential contacts, and reject the other.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Terrain <-> Compound Collision World Scale Problem

Postby Julio Jerez » Sun Oct 28, 2018 10:37 am

Oh I was looking at the collsion bug with terrain, this is a probably 10 year old bug
I happens here,

Code: Select all
dgInt32 dgCollisionCompound::CalculateContactsToHeightField (dgBroadPhase::dgPair* const pair, dgCollisionParamProxy& proxy) const
{
   dgContactPoint* const contacts = proxy.m_contacts;

   const dgNodeBase* stackPool[DG_COMPOUND_STACK_DEPTH];

   dgInt32 contactCount = 0;
   dgContact* const contactJoint = pair->m_contact;
   dgBody* const myBody = contactJoint->GetBody0();
   dgBody* const terrainBody = contactJoint->GetBody1();

   dgCollisionInstance* const compoundInstance = myBody->m_collision;
   dgCollisionInstance* const terrainInstance = terrainBody->m_collision;

   dgAssert (compoundInstance->GetChildShape() == this);
   dgAssert (terrainInstance->IsType (dgCollision::dgCollisionHeightField_RTTI));

// this is where the bug happen, the calculation of the aabb workj on the heighfiel, ignopring the scale
   dgCollisionHeightField* const terrainCollision = (dgCollisionHeightField*)terrainInstance->GetChildShape();

   proxy.m_body0 = myBody;
   proxy.m_body1 = terrainBody;


basically in the old days were happy to have terrain that worked, no one care about scaling a heightfield, so when I added the collsion intace to deal with scales, that function felt through the crack.
essentially is searching for the colliding grids in the wrong place.
It is time to fix it now.

can you test is this happen when the terrain is not scaled,
just to make sure I am not incorrect on thsi assessment?
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Terrain <-> Compound Collision World Scale Problem

Postby Julio Jerez » Mon Oct 29, 2018 9:50 am

ok this is fixed now.
This was a long time incomplete featured, that was never an issue because your are the first person in
14 years yow ha even scaled a terrain. I have scale collsion tree, but not terrain.

I thin I read you said this happens with scaled collision tree and compound as well, but I check the code
and the scale is applied there, so unless there is a bug there, I beleive that should be working.
can you test that? is you have ther repro.

anyway the heightfield is fixed now.
Thank for the repro. and keep teh bug coming. :D
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Terrain <-> Compound Collision World Scale Problem

Postby MeltingPlastic » Mon Oct 29, 2018 1:02 pm

That fixed it! Thanks!
MeltingPlastic
 
Posts: 237
Joined: Fri Feb 07, 2014 11:30 pm

Previous

Return to Bugs and Fixes

Who is online

Users browsing this forum: No registered users and 2 guests