- Home /
Voxel spaceship collider
In the game I'm working on I want players to be able to make spaceships using voxels and fly them around in 3D. The problem is ships colliding with each other. Mesh colliders won't work because the collision meshes would be more than 255 triangles, AABB won't work because the ships are able to fly in any direction. Is there a way to use the voxel data to detect collisions in a way that still lets me use PhysX? Is there a way I can use OBB with PhysX?
Was this ever solved? I'm looking for a solution, so i can use them in ships like starmade.
Answer by Kiloblargh · Nov 26, 2013 at 04:47 AM
I saw a video on Youtube that was explaining how they made Mushroom 11, a game where you have a voxel-based fungoid character with physical collision. Look that up. They used capsules of varying sizes, which were allocated as needed from an object pool. That character was changing shape and size constantly, and presumably your ships will stay the same shape once built, so it wouldn't be that hard. I would probably make a detailed set of box colliders generated at the time the ship is built by some kind of "try to fit the biggest box inside the voxel volume, then try to fit medium sized boxes wherever they will fit in what's left, then fill in the edges with small ones" procedure. Then disable them all and only turn them back on if and when the ships' bounding spheres collide.
This unfortunately seems the only way to solve the problem. I would prefer a custom way to bake collision meshes though.