Modeling Destructible Bridges
To make the bridge fashions, the bridge dimensions should have a facet ratio appropriate with the pathfinding grid nodes. Scale can all the time be mounted later. To create the destructible bridge, I copy the unique mannequin and minimize it up utilizing a knife instrument. It’s vital that the destroyed mannequin and authentic mannequin have the identical origin, scale, and UVs.
Once I had my items for the destroyed bridge, I separated them by choice which created 2 objects (meshes). And lastly, the newly created objects have holes that should be stuffed and as soon as stuffed, the brand new faces wanted new UV coordinates.
Programming Destructible Bridges
In order to create pathways throughout unwalkable rivers, every pathfinding node wants its personal block collider in order that the bridge can edit the nodes it resides in. To make this simple, I merely had the pathfinding grid add these blocks for every node that was beneath sea stage.
If items have been current on the bridge on the time of destruction, the destroyed bridge will destroy the items referenced by a collider that data items touching it.
Finally, the destroyed bridge will change its mesh to the destroyed bridge mesh and instantiate the damaged piece on the identical place and rotation. As lengthy as each fashions have the identical origin, scale, UVs, and positions, the transition will probably be seamless and seem to interrupt.