jPCT-AE - a 3d engine for Android > Support
checkForCollisionSpherical for small sphere
grog:
I have a large mesh that I use for a level and multiple smaller meshes representing players that reside within it. The players collide with each other and the map without issue, using a mix of ellipsoid and spherical checks. I also have even smaller meshes that I was using for grenades, but the spherical collision detection is not working consistently for these unless I use a radius that is way too large. Basically, using checkForCollisionSpherical with radius 0.5, sometimes the grenades collide with the walls/floor correctly, but other times they pass straight through without registering a collision. The same things happens with ellipsoid collision at the same size. If I up the radius to 1, every collision is detected, but the result looks bad because the grenade reacts before it visually hits the wall and floats above the floor due to the too-large sphere. If I decrease the radius (say 0.3), no collisions are detected.
I tried checking the docs for some config settings that might help, but I don't see anything that obviously relates to this. Playing with Config.collideOffset didn't seem to make a difference. I would appreciate any help/ideas.
EgonOlsen:
For spherical collision detection, this might happen because the algorithm only takes start and end point into account. If the radius is small and the transition is large in comparison, neither might indicate a collision. However, this shouldn't be a problem when using ellipsoid collision detection...have to tried to subdivide the translation? How long is the translation vector? It might happen, that a rough check at the beginning of the collision detection fails if the radius is small compared to the translation's lenght, but i'm not sure...
grog:
Ahh, that's good to know about the spherical algorithm. Makes sense now why it's not quite working for me. Hmm, I might have to take another look at ellipsoid, or maybe I can subdivide the translation like you say. Thanks much!
EgonOlsen:
If sub-dividing helps, please let me know. I'll then look into a way to fix this problem in the engine itself.
grog:
Ok, so I adjusted my method to subdivide the translation vector based on the radius of the sphere and make successive calls to checkForCollisionSpherical() until the entire desired movement length is reached. So far, everything seems to be working perfectly.
Navigation
[0] Message Index
[#] Next page
Go to full version