HeightField Collision Dynamic AABB Update

Report any bugs here and we'll post fixes

Moderators: Sascha Willems, Thomas

HeightField Collision Dynamic AABB Update

Postby jamesm6162 » Wed Mar 02, 2016 5:45 am

Hi Julio

I know there has been a thread on how to update a heightfield collision dynamically (see viewtopic.php?f=9&t=5117)

This works. However when updating the heights, there is no way to update the AABB of the height field, or to force it to recalculate its AABB.

So when your heights change from a range of, say [-1,1] to a range of [50,52], or even [-5,5] The local AABB will be wrong (still at [-1,1]) and you will get missed collisions.

Is there any way to get around this problem. I don't see any access to the dgCollision::SetCollisionBBox function from the Newton C interface.

Thanks

James
jamesm6162
 
Posts: 49
Joined: Wed Aug 12, 2015 8:50 am

Re: HeightField Collision Dynamic AABB Update

Postby Julio Jerez » Wed Mar 02, 2016 8:04 am

do you mean to refresh the entire AABB, of the height field?
Julio Jerez
Moderator
Moderator
 
Posts: 11039
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: HeightField Collision Dynamic AABB Update

Postby jamesm6162 » Mon Mar 07, 2016 3:53 am

Well recalculating the AABB is quite a costly operation to perform, as the code runs through all the heights to get the lowest and highest ones.

The problem is that it is only done at collision creation time, meaning any changes to the heights are not reflected in the AABB later on.

Perhaps if there was an interface to manually set the min/max heights, it could rather use those as the AABB vertical extent.

In most cases my heightfields are created with all zeros as heights, because the heights get filled dynamically later on. This means my AABB height is 0. If I could force the heightfield to a specific min/max height it would solve my problem.
jamesm6162
 
Posts: 49
Joined: Wed Aug 12, 2015 8:50 am

Re: HeightField Collision Dynamic AABB Update

Postby Julio Jerez » Mon Mar 07, 2016 7:45 am

If I understand the problem, you are editing the height field at runtime. and the AABB is not being update to map the change. is this the problem?

you could do a simple trick.

-before creating the height field, take elevation at point h(0, 0) and make it the size you want it to be.
-them call Create the heightField.
-then set the value to what it should be. This will make leave field AABB the size you want and will not changed after that.
I believe that should solve the problem.
Julio Jerez
Moderator
Moderator
 
Posts: 11039
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: HeightField Collision Dynamic AABB Update

Postby jamesm6162 » Tue Mar 08, 2016 5:09 am

Thanks. In the end that's exactly wat I did.
jamesm6162
 
Posts: 49
Joined: Wed Aug 12, 2015 8:50 am


Return to Bugs and Fixes

Who is online

Users browsing this forum: No registered users and 1 guest