Heightfield collision don't occur over a certain height

Report any bugs here and we'll post fixes

Moderators: Sascha Willems, Thomas

Heightfield collision don't occur over a certain height

Postby pHySiQuE » Wed Jan 24, 2018 11:40 am

We're seeing a bug where heightfield collisions are missed when they occur above a minimum height. I am using 16-bit unsigned integers for my heightfield data. I am guessing this is just a bounding box issue and should be easy to fix.
pHySiQuE
 
Posts: 608
Joined: Fri Sep 02, 2011 9:54 pm

Re: Heightfield collision don't occur over a certain height

Postby Julio Jerez » Wed Jan 24, 2018 1:04 pm

I believe elevation data is assumed to be signed for all supported types.

If you want to use the full range of a 16 bit not you could subtract 1024 * 8 - 1 from all samples and pass and offset matrix set to that value time the salvation scale, to the collision shape.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Heightfield collision don't occur over a certain height

Postby Leadwerks » Wed Jan 24, 2018 4:15 pm

From dgCollisionHeightField.h:
Code: Select all
   public:
   enum dgElevationType
   {
      m_float32Bit = 0,
      m_unsigned16Bit,
   };
User avatar
Leadwerks
 
Posts: 569
Joined: Fri Oct 27, 2006 2:54 pm

Re: Heightfield collision don't occur over a certain height

Postby Julio Jerez » Wed Jan 24, 2018 4:36 pm

Oh yes it is an unsigned16, the bug is here:

Code: Select all
void dgCollisionHeightField::CalculateMinAndMaxElevation(dgInt32 x0, dgInt32 x1, dgInt32 z0, dgInt32 z1, const dgInt16* const elevation, dgFloat32& minHeight, dgFloat32& maxHeight) const


that function calculate the AABD but the argument is a const dgInt16* const elevation
is should be const dgUnsigned16* const elevation

you can make that change yourself and it should fix it or you can get files:
../sdk\dgPhysics\dgCollisionHeightField.cpp and h
and replace the one you have.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Heightfield collision don't occur over a certain height

Postby Leadwerks » Wed Jan 24, 2018 9:46 pm

Cool, I got it working.
User avatar
Leadwerks
 
Posts: 569
Joined: Fri Oct 27, 2006 2:54 pm


Return to Bugs and Fixes

Who is online

Users browsing this forum: No registered users and 6 guests

cron