Hi there,
I have a 3ds model of a village and have imported this onto my scene. As originally anticipated, I knew my character would simply fall/walk through everything. For now, I’ve added a plane on the floor so that he can at least tread the village’s surface.
I wanted to know if there’s any possible in-built mechanic or efficient way of adding the necessary physics/colliders to my village model? I really want to avoid adding physics/colliders to every element of the village (such as fences, houses, slopes, hills etc). Is there a way of Unity detecting objects and obstacles of this model?
Many thanks for your time in advance.
Thanks for your reply @VesuvianPrime. I've added a Mesh Collider, but my character can still walk through things. Is this something to do with the Mesh and/or Material fields? I've read the documentation and cannot extract any useful information from it to solve this problem. Also, what do you mean by fully automatic? I understand what you mean by manually doing this, but what you've described as automatically doing it sounds the same as manually doing it. Thanks.
– AKJ9You will need to assign the terrain mesh to be the collision mesh on the MeshCollider to get anything useful out of it. By fully automatic, I mean writing an editor script to loop through the asset and add colliders. Honestly, it would probably take longer to write the script than to do it manually. Besides, with the manual approach you'll be able to get the colliders exactly as you want them.
– VesuvianPrimeI see, thank you. I'll avoid the automatic method and do it manually if this MeshCollider method doesn't work. With regards to the MeshCollider method, apologies for the rookie question, but where do I locate the terrain mesh for this model? When I've created actual terrains in the past, the terrain mesh for each is present. However, as this is simply a 3ds model (GameObject), I believe there is no terrain mesh allocated to it. Thanks for your support and swift replies.
– AKJ9If you look at your GameObject you should see a MeshFilter Component. This MeshFilter will contain the Mesh that represents your terrain. If you click the Mesh it should highlight the location in the project view. Alternatively, if you click the dot next to the Mesh field in the inspector it will open a new menu that lists all of the Meshes in your project. You can search and filter through this to find your terrain mesh.
– VesuvianPrimeNearly there! So I've located the Mesh that was in the MeshFilter component of my GameObject. However, this is not the mesh that represents my entire terrain, rather only a small door/sign of the terrain (strange). Regardless, I found a Mesh that captured a lot of the terrain, but still not all of its entirety - I've assigned this to the Collision Mesh field anyway. As we can only assign one Mesh to the Collision Mesh, would this mean I'd have to create manual colliders for the remaining objects? Many thanks.
– AKJ9