Loading external .obj file, and create and attach a mesh collider at runtime

Hi,

I need to load an external .obj file and attach a mesh collider. I found this asset that seems to do just that →

Does anyone know of a better solution?

Thanks!

The obj format itself is well known and you may be able to build a parser for it yourself pretty quickly, especially if you only need a subset of the features (e.g. just vertices, triangle faces, and normals). You could probably build such a thing just by reading the wikipedia entry here: Wavefront .obj file - Wikipedia

Once you’ve actually built a mesh object, you just need to assign that mesh to your MeshFilter and MeshCollider components in order to use it.

Of course if you value your time more than your money, it’s probably worth just buying an asset.

2 Likes