FBX Does Not Import Mesh Collider Properly
Posted: Mon Oct 04, 2021 10:37 pm
So, I decided to work on colliders for the animal models. Can't have animals phasing through people and objects and you.
So, creating and adding a mesh collider is easy. Add it to the prefab, then drag the horse mesh body onto it. And done.
However, upon the prefab being imported, the mesh collider won't work.
Here is the exact reason. When the prefab is pulled into the fbx, it assigns the mesh collider to the main parent animal object. However, the actual mesh renderers are within the child mesh model object, not the parent container object. As a result, the mesh collider doesn't connect to the mesh renderer for the individual sub-model part.
However, the moment I add the mesh collider to the horse body sub-object/model, it works. This is where the mesh renderers are setup.
I can work around this script side, as always, but it would be nice for future projects for mesh colliders to be imported correctly from the prefab parent so it doesn't require extra script code lines.
Outside that, I can revert it to simple box colliders to skip using runtime scripts.
So, creating and adding a mesh collider is easy. Add it to the prefab, then drag the horse mesh body onto it. And done.
However, upon the prefab being imported, the mesh collider won't work.
Here is the exact reason. When the prefab is pulled into the fbx, it assigns the mesh collider to the main parent animal object. However, the actual mesh renderers are within the child mesh model object, not the parent container object. As a result, the mesh collider doesn't connect to the mesh renderer for the individual sub-model part.
However, the moment I add the mesh collider to the horse body sub-object/model, it works. This is where the mesh renderers are setup.
I can work around this script side, as always, but it would be nice for future projects for mesh colliders to be imported correctly from the prefab parent so it doesn't require extra script code lines.
Outside that, I can revert it to simple box colliders to skip using runtime scripts.