Hey all,
I'm using a btHeightfieldTerrainShape, I'm animating it each frame with a simple sin() and having it affect a btConvexHullShape -> btRigidBody. It seems to be causing a lot of jittering if the rigidbody is resting on it at larger values. I'm using CCD but that doesn't seem to be helping much, any advice?
It looks like the wave is moving up through the rigidbody then the rigidbody is moving a lot to correct the penetration rather than smoothly moving with it?
Looks like this - http://gfycat.com/WindyZigzagBallpython
On bits where the terrain doesn't move its nice and solid - http://gfycat.com/ObedientKindCollie
I'm updating the data that is passed into the 3rd argument of btHeightfieldTerrainShape(), I'm not recreating the btHeightfieldTerrainShape each time if that makes any difference?
Cheers
Dave
Dynamic btHeightfieldTerrainShape causing jittered collision
-
- Posts: 6
- Joined: Tue Oct 13, 2015 8:43 am
-
- Posts: 51
- Joined: Tue Dec 11, 2012 9:59 pm
Re: Dynamic btHeightfieldTerrainShape causing jittered colli
I had similar issues with just a ball colliding with a fixed surface; that the correcting impulse seemed to be much larger than one would expect.
The engine I'm sure isn't doing anything other than realizing that the thing has collided and generating a impulse to push it away.
1) does it change if you change the mass?
2) was thinking about making a test case that starts with a body near, on and in another ground body at various depths and seeing how much the various bodies react in one frame...
The engine I'm sure isn't doing anything other than realizing that the thing has collided and generating a impulse to push it away.
1) does it change if you change the mass?
2) was thinking about making a test case that starts with a body near, on and in another ground body at various depths and seeing how much the various bodies react in one frame...
-
- Posts: 6
- Joined: Tue Oct 13, 2015 8:43 am
Re: Dynamic btHeightfieldTerrainShape causing jittered colli
I think I've narrowed down the issue...
At the time of generating the initial heightmap I had tightly clamp the min, max of it. During the animation of it the wave can go outside of that min/max. I've added some padding and it seems to behave much better now, I just need to clean it up and properly calculate the possible min/max now.
http://gfycat.com/ClumsyBareBrahmancow
At the time of generating the initial heightmap I had tightly clamp the min, max of it. During the animation of it the wave can go outside of that min/max. I've added some padding and it seems to behave much better now, I just need to clean it up and properly calculate the possible min/max now.
http://gfycat.com/ClumsyBareBrahmancow
-
- Posts: 225
- Joined: Wed Jan 07, 2009 11:43 am
- Location: London
Re: Dynamic btHeightfieldTerrainShape causing jittered colli
That still seems a little bit 'bouncy' for what doesn't seem like much deflection in the height field.
Have you tried playing with restitution for you ship a bit ? might get things a little smoother.
Have you tried playing with restitution for you ship a bit ? might get things a little smoother.
-
- Posts: 6
- Joined: Tue Oct 13, 2015 8:43 am
Re: Dynamic btHeightfieldTerrainShape causing jittered colli
Yeah it is still not quite right, could be because I just bodged in some numbers to pad the min/max and I've not really calculated what it really could be. I'll do that properly tonight (perhaps try and visualise the AABB too, could be useful) and also look at the restitution too (currently its set to 0.1), cheers for the pointer, I hadn't considered that.
-
- Posts: 6
- Joined: Tue Oct 13, 2015 8:43 am
Re: Dynamic btHeightfieldTerrainShape causing jittered colli
Yay, all sorted now...
http://gfycat.com/DisgustingNeglectedFieldmouse
The min/max of the btHeightfieldTerrainShape is properly calculated and the origin is correctly set. Then the other thing was that some times the ship rigidbody would go to sleep, so making sure that is active when on the moving ground helps.
http://gfycat.com/DisgustingNeglectedFieldmouse
The min/max of the btHeightfieldTerrainShape is properly calculated and the origin is correctly set. Then the other thing was that some times the ship rigidbody would go to sleep, so making sure that is active when on the moving ground helps.
-
- Posts: 225
- Joined: Wed Jan 07, 2009 11:43 am
- Location: London
Re: Dynamic btHeightfieldTerrainShape causing jittered colli
Yay, that looks much better