FBX Does Not Import Mesh Collider Properly

Discuss modding questions and implementation details.
Post Reply
l3lessed
Posts: 1399
Joined: Mon Aug 12, 2019 4:32 pm
Contact:

FBX Does Not Import Mesh Collider Properly

Post by l3lessed »

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.
My Daggerfall Mod Github: l3lessed DFU Mod Github

My Beth Mods: l3lessed Nexus Page

Daggerfall Unity mods: Combat Overhaul Mod

Enjoy the free work I'm doing? Consider lending your support.

l3lessed
Posts: 1399
Joined: Mon Aug 12, 2019 4:32 pm
Contact:

Re: FBX Does Not Import Mesh Collider Properly

Post by l3lessed »

Just wanted to point out, I was being a dummy with prefabs again, and this was just my issue of misunderstanding how the sub-components work in a prefab setup.

If you run into this issue yourself, don't be a dummy like me. Click the open prefab button, then dig down to the sub-component that you need the mesh collider attached to; In my case it was the 3d mesh for the body of the horse. Select it, then add the mesh collider to this. Close the prefab and now the mesh collider will attach to the component with the 3d mesh and provide proper 3d colliders for the model.
My Daggerfall Mod Github: l3lessed DFU Mod Github

My Beth Mods: l3lessed Nexus Page

Daggerfall Unity mods: Combat Overhaul Mod

Enjoy the free work I'm doing? Consider lending your support.

Post Reply