Heightfield collision, newton 2

Report any bugs here and we'll post fixes

Moderators: Sascha Willems, Thomas

Heightfield collision, newton 2

Postby Crashy » Mon Mar 19, 2012 8:28 am

Hello,

I'm using an heightfield collision to manage collisions with Ogre terrain, I use Newton 2 and Ogrenewt 2, both last versions, and I'm facing two problems:

-Sometimes objects fall through the terrain.
-ray casting quite never works.

My world is quite big and moving objects are fast and relatively small, the newton world is 100 000 units wide, the terrain is 50 000 units wide (I need to have some extra space around the terrain), moving objects are 20 units long and moves at 100 units / seconds.

Moving object versus moving object collision are working good, but not moving object against terrain, and I don't know why sometimes it works and sometimes not.

Also notice that I've got the same issues when I use double precision.


Thanks for any help, I'll give more informations if needed.
Crashy
 
Posts: 101
Joined: Fri Dec 03, 2010 6:30 am

Re: Heightfield collision, newton 2

Postby Julio Jerez » Mon Mar 19, 2012 10:06 am

are you using ogrenewt or are you usin you own integrations?
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Heightfield collision, newton 2

Postby Crashy » Mon Mar 19, 2012 10:11 am

Yes I'm using ogrenewt.

I've just seen that sometimes, when the object goes through the terrain, the collision is "inverted", I mean it's impossible to go back on the upper side of the terrain. Maybe it's a just bug from ogrenewt heightfield collision creation code, but I'm not sure.
Crashy
 
Posts: 101
Joined: Fri Dec 03, 2010 6:30 am

Re: Heightfield collision, newton 2

Postby Julio Jerez » Mon Mar 19, 2012 11:14 am

Using Ogre newt, can be a problem this time because altoh the wroare is open source no one maintaine it, and bug fix never made to the current update.
Netwon is already on version 3.00 and all o fteh collisoin has being optimize and many, many bug has bing fixed already. specailly colliison with polygon field which is the same as collision mesh in newton.


on the bug, collision are only one side in newton. it may be that the heightfild is upside down. you can simple rote teh matroix but 180 aroun any axis and the should fix it.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Heightfield collision, newton 2

Postby Crashy » Mon Mar 19, 2012 11:34 am

The collision mesh is not totally upside down, sometimes it's in the right side, sometimes not, I don't understand why as the code to build a heighfield collision mesh is really simple.

I plan to use Newton 3.00, I already have made an conversion of ogrenewt for newton 3.00 but for the moment it stills crash on my game so I conitnue using newton 2 until you release a more stable version. I've seen on svn that you've made a big commit but still unstable, I'm looking forward to the next commit:)
Crashy
 
Posts: 101
Joined: Fri Dec 03, 2010 6:30 am

Re: Heightfield collision, newton 2

Postby Julio Jerez » Mon Mar 19, 2012 11:50 am

did you make the changes, to move to newton 300?
after the last commit core 300 is no loneg compatible with core 200 because the collision are very different.

a crash is different than a malfuntion. you mention that your object moves very fast, and take long time step.
did you use continues collisions?
That is actually one of the reasons why I mentioned that using core 300 in the way to solve the problem. you are having a problem that is part of the limitation of core 200 and all previuos version of newton.

Continue collision worked buy trying to predict that contacts ahead of time, but that is a mistake. because conctacts outside a collision shape lead to incorrect physics behaviors.
Netwon 300 is remeding that problem by using a hybrid aproach using the collision system and the solver working together to determine the time of impact,
this can solve both rotationat and linear movement as opposet to before that only handled linear moments.

when you try core 300 can you tell me whe it is crashing? I believe it will be better to solve that an move on than trying to force core 200 to deal with a problem that it does not really designed for.
Like I say Continues collision would be the solution but continues sollution in core 200 is a last recorse to prevent penetration, while in core 300 continues collision design call for correct physics responce at all time.


There is also another issue you mention that can cause the prombelm you are seeing. you mention the world is 100,000 unit in side, that means that when a body is close to the edge of the workd.
its location will use about 18 bits out of 24 of the mantiza of a float. that leaves only 6 bit for fractions. this will make that float operation will be very unrealible.

Netwon 300 is design also call for a solution for that, it is not there yet, but newton 300 the broaphase no longer has a world size.
world can be on unlimite size inb core 300, for that bodies will have the location from by two values the segment and the base.
what this omean is that each oject the calculateion are all relative to the segment they are in, so for an island it will no matter where the position of an object is it will always be calculate with sufficent bits of presitions.
these will alse used for streaming large world.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Heightfield collision, newton 2

Postby Crashy » Mon Mar 19, 2012 11:59 am

I use continuous collision, yes.

I'll follow your advice and update to newton 3.00, and tell you problems I may have with it. Thanks.
Crashy
 
Posts: 101
Joined: Fri Dec 03, 2010 6:30 am

Re: Heightfield collision, newton 2

Postby Julio Jerez » Mon Mar 19, 2012 12:02 pm

when you do it could you tell me where the crash happens?
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Heightfield collision, newton 2

Postby Crashy » Mon Mar 19, 2012 12:04 pm

Yup of course.
Crashy
 
Posts: 101
Joined: Fri Dec 03, 2010 6:30 am

Re: Heightfield collision, newton 2

Postby Crashy » Mon Mar 19, 2012 1:24 pm

With the new version it crashes here in debug:

Code: Select all
dgInt32 dgCollisionCompound::CalculateContactsToHeightField (dgCollidingPairCollector::dgPair* const pair, dgCollisionParamProxy& proxy, dgInt32 useSimd) const
{
   _ASSERTE (0);
   return 0;
}


Which is perfectly normal, seems the compound collision are not fully implemented right now..

In release with debug infos it crashes around these lines in the function dgWorldDynamicUpdate::BuildJacobianMatrix

Code: Select all
_ASSERTE (m0 >= 0);
_ASSERTE (m0 < bodyCount);
dgBody* const body0 = bodyArray[m0].m_body;
Crashy
 
Posts: 101
Joined: Fri Dec 03, 2010 6:30 am

Re: Heightfield collision, newton 2

Postby Julio Jerez » Mon Mar 19, 2012 1:33 pm

Oh I see, that was the next, next function I was going to re-enable for the compound.
I have compound to single and compound to hieghtfeild for funlly complete the compound
I could not do it because I have to write the unit test demo first.

I just added the heighfield last week, now I can change the unit test tonight so that it makes a heighfiled for background
and the two functions will be there by tomorrow.
Thanks for the test.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Heightfield collision, newton 2

Postby Crashy » Mon Mar 19, 2012 1:42 pm

Ok, thank you very much.
Crashy
 
Posts: 101
Joined: Fri Dec 03, 2010 6:30 am

Re: Heightfield collision, newton 2

Postby Julio Jerez » Tue Mar 20, 2012 8:45 am

alright, you can sync again and now ther is a terrain/compound unit test.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Heightfield collision, newton 2

Postby Crashy » Tue Mar 20, 2012 9:20 am

Thanks, now it asserts at:

Code: Select all
_ASSERTE (m0 >= 0);


in dgWorldDynamicUpdate::BuildJacobianMatrix,

m0 and m1 are set to -842150451, seems to be a negative value set in an uint, or a non initialized value.
Crashy
 
Posts: 101
Joined: Fri Dec 03, 2010 6:30 am

Re: Heightfield collision, newton 2

Postby Julio Jerez » Tue Mar 20, 2012 9:45 am

does that happen in you test or in teh sdk demos?
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Next

Return to Bugs and Fixes

Who is online

Users browsing this forum: No registered users and 9 guests

cron