btCollisionWorld rayTest limitation

jojojijijojo
Posts: 6
Joined: Sun Oct 13, 2013 5:46 pm

btCollisionWorld rayTest limitation

Post by jojojijijojo »

Greetings everyone,
I have successfully integrated bullet with my game engine and everything works just fine.
However, I have a problem with rayTest using btCollisionWorld::ClosestRayResultCallback.
Here is the scenario: My world terrain is composed of pages ( chunks), each page has its own btBvhTriangleMeshShape. So the terrain is composed of different btBvhTriangleMeshShape's all of them are static.
Then I have a rigidbody representing the character.
Now here is the problem: If the character is withing let's say page 1, then I can ray test and get hit result just fine withing that page 1 boundaries only!
If my character is withing page 1 and I try to rayTest lets say page 3 or 4, then the ray returns no result.(Im doing vertical ray from top->down to get the height of the terrain at specific x, z locations).
In other words, the btBvhTriangleMeshShape needs to have some sort of contact with a rigid body for the raytest to detect it and return a result.
The other weird problem is that let's say page 3 didn't return hit, I walk with my character to page 3 then come back to page 1, then boom, the rays now hit page 3. It just have to have at least one rigidbody contacting it, then it doesn't matter if that rigid body is still withing that page or not, it get's activated and starts receiving the raytests.