Hi,
I'm trying to modify the character controller class so I can use it in my game. I have it running with a btBvhTriangleMeshShape for the terrain but I notice when I step into recoverFromPenetration it never finds any collisions i.e. m_ghostObject->getOverlappingPairCache()->getNumOverlappingPairs() is always zero.
Collisions occur in stepUp/stepDown/stepForwardAndStrafe where it does a convexSweepTest manually with the ghost object. How come recoverFromPenetration never detects any collisions but the convexSweepTests later still work?
Thanks.
btKinematicCharacterController and recoverFromPenetration
-
- Posts: 8
- Joined: Wed Sep 30, 2015 8:51 pm
-
- Posts: 456
- Joined: Tue Dec 25, 2007 1:06 pm
Re: btKinematicCharacterController and recoverFromPenetratio
Not sure if this is helpful or not, but a long time ago, I found a similar problem and posted a possible solution here (please read only my last post): http://bulletphysics.org/Bullet/phpBB3/ ... 566#p32566.
Basically, AFAICR, I needed to put my controller outside the aabb of the btBvhTriangleMeshShape at the start of the simulation to properly handle collisions and solve the problem.
Otherwise, although everything seems to be OK, you will probably experience some collision problems in the long run (see the video in the post).
Basically, AFAICR, I needed to put my controller outside the aabb of the btBvhTriangleMeshShape at the start of the simulation to properly handle collisions and solve the problem.
Otherwise, although everything seems to be OK, you will probably experience some collision problems in the long run (see the video in the post).
-
- Posts: 8
- Joined: Wed Sep 30, 2015 8:51 pm
Re: btKinematicCharacterController and recoverFromPenetratio
Hi!
I've been reading that, very helpful, I'll give it another try. I solved a similar 'crash when starting inside'. I traced it to the sweep having the same start & end data though.
I'm at the stage where I'm thinking of starting again from scratch. I don't need stairs and steps, just something that will collide with a terrain and slide over slopes, so I'm just trying to read up on ghost objects now. I take it a kinematic body won't do because it would just go through the floor of my terrainmesh if some 'gravity' was applied.
I've been reading that, very helpful, I'll give it another try. I solved a similar 'crash when starting inside'. I traced it to the sweep having the same start & end data though.
I'm at the stage where I'm thinking of starting again from scratch. I don't need stairs and steps, just something that will collide with a terrain and slide over slopes, so I'm just trying to read up on ghost objects now. I take it a kinematic body won't do because it would just go through the floor of my terrainmesh if some 'gravity' was applied.
-
- Posts: 8
- Joined: Wed Sep 30, 2015 8:51 pm
Re: btKinematicCharacterController and recoverFromPenetratio
I just quickly spawned my character above the max height of the terrain AABB and you're right, recoverFromPenetration suddenly started working again!
hmm I wonder if I can get rid of those convexSweepTests now then.
Thanks Flix!
hmm I wonder if I can get rid of those convexSweepTests now then.
Thanks Flix!
-
- Posts: 8
- Joined: Wed Sep 30, 2015 8:51 pm
Re: btKinematicCharacterController and recoverFromPenetratio
Hello again,
I'm still working on this. I have a pretty simple implementation of a kinematicCharacterController that uses only recoverFromPenetration to resolve collision. However, it seems only to work 99% of the time. I move the capsule slightly into the ground each update and I resolve the collision, occasionally - for no reason I can find, there is a zero collision, and the character drops 10cm, then the next frame it finds a collision twice as deep and resolves the character back onto the correct surface again.
Anyone seen anything like that?
Thanks.
I'm still working on this. I have a pretty simple implementation of a kinematicCharacterController that uses only recoverFromPenetration to resolve collision. However, it seems only to work 99% of the time. I move the capsule slightly into the ground each update and I resolve the collision, occasionally - for no reason I can find, there is a zero collision, and the character drops 10cm, then the next frame it finds a collision twice as deep and resolves the character back onto the correct surface again.
Anyone seen anything like that?
Thanks.
-
- Posts: 8
- Joined: Wed Sep 30, 2015 8:51 pm
Re: btKinematicCharacterController and recoverFromPenetratio
Actually, I may have solved it. The area I was using to test had some very large thin triangles and I think that was causing it. I split the mesh into sections and the collision response seems much better. It still jitters a bit when I push into corners but that's a different story.