Visible geometry Collisions

After rethinking my collision systemfor my game ive decided itd be best to make one collision solid (the player) and test it against visible geometry (the world) since the world is is a bunch of flattenStrong()ed cubes i think itd be better than assigning a collisionCube() to each of the 1000’s of cubes that make up the world. I just ave NO CLUE how to even begin testing a collision solid against visible geometry. I saw this … n_Bitmasks but had little luck understanding. all i know is i need to set a bitmask on the visible geom to act as an into object.

This would do it:


This sets a single bit (bit 0) on the into collide mask of all GeomNodes and CollisionNodes at model and below. Since your from object probably has at least bit 0 set on its from collide mask (the default is most bits on), this will enable collisions with all GeomNodes under model.

However, this is still a terrible idea. Collisions with visible geometry is about 100 times slower than collisions with actual collision geometry, even geometry of the exact same shape. This is because the collision geometry is optimized for the collision calculation, but the visible geometry is only optimized for rendering.


If I may add to this thread… What I’ve learnt in other projects is that your collision meshes should be different from your render meshes for performance purposes. Let’s say your model has 20,000 polys. You need all these polys to properly render the model and present it. So it looks spelendid and all that. But you might (maybe) only need 4 collision polys. Or a sphere collision mesh. There is simply no need for such level of details in your collision system.

What I’ve experienced in game engines (as per hardware capacities of today’s computers) is render models of perhaps upto 50k polys. Maybe it’s more today, I’m not that much up-to-date with all the recently released games out there. And in terms of collision meshes probably upto 500. Really you shouldn’t go higher unless you have a specific reason.

Blender can handle collision meshes really well. I always struggled with exporting the collisions from other modelling software.

Hope this helps, but of course I’m only an amateur. So full respect to all the experts in this forum.

I understand were you are coming from. If you are making a minecraft-like game and if you are on the surface you do not want to do a collision check to blocks that are 200 blocks below you.

I am a panda newb, so I would take my word with a grain of salt, but if I was you I would re-read about collision solids in panda. You could create a collision polly of a cube or maybe collision spheres because they are the fastest for each of the cubes. And a collision sphere for the character or maybe a collision tube. That way it would keep the amount of data to collision check pretty simple.

I do not know how you have your 3D grid set up maybe you could only have the collision checks for a certain distance from your character?

Or maybe set up zones in your 3D grid, where only while you’re in a certain zone will collision checks be run for that zone.