Help me please i have problem whit mesh collider

Heloo i have problem whit mesh collider on big castle .fbx and verry lags.

Game is for android and is unplayable

Verry Thank you for answering

How many polys is it? Is it very detailed?

Mesh colliders are very expensive to use and will eat up your performance quickly. Especially for mobile devices. You really shouldn’t use them unless you have no choice.

yes Is it very detailed Castle is also from the inside

Ryiah What would be a replacement for the mesh collider??

That is exactly your problem… You’re best off breaking it into Sections and applying basic colliders to it to get as close to a good fit as possible…

I only use mesh colliders for abnormal objects like Rocks that players can walk on. Otherwise I try my best to leave Mesh Colliders alone.

If you didn’t have many polys I’m sure that would be fine.
But as Ryiah said, they eat performance quickly.

Replace the mesh collider with multiple simple colliders such as box colliders.

Box collider not possible give on castle because is verry complex

Like I said, break it into multiple pieces.

or add 10000 box colliders to one object if you wish, but that’s no better than a mesh collider.

We’re just trying to help guide you in the right path.

N1warhead I am a beginner and I did not know that it will be problem

wrote i have this script but also so meshcolider lags

castle is riven on more part but no enough

var object1 : GameObject;

function OnTriggerEnter (other:Collider) {

if(other.gameObject.tag == “Player”){
object1.GetComponent(MeshCollider).enabled= true; // make very sure

}}
function OnTriggerExit (other:Collider) {

if(other.gameObject.tag == “Player”){
object1.GetComponent(MeshCollider).enabled= false; // make very sure

}}

Exactly how many polygons are there?

Otherwise I don’t know what else I can say or do other than learn how to optimize your models.
Keyword (“Learn”)

One of the easiest ways is learn to learn “Bridging”

Or go to your 3d modeling program (if you have one) - you make it sound like you went to turbosquid and downloaded a caslte.
But goto a 3d modeling program and look for Optimize modifiers. They can help a lot as well in optimizing modelings with fewer polygons.

Scripts aren’t gonna help you in the case, the model is what the model is, it’s a lot of Geometry according to how you make it out to be. It’s not gonna change that the model is extremely detailed and it needs to be less detailed.

Learn to optimize it or get another model with less detail or learn to break them into pieces and still use fewer details with Geometry and learn to how to use Normal maps for the details and Displacement maps, etc.

Thanks I will learn him divide or I put into castle 100 box colliders :slight_smile:

sorry me English is weak

Your English is fine buddy.

Just understand, the less colliders you have the better. But likewise, it’s not just colliders.
If your model has WAAAAY to much detail that is enough to crash anything.

it is clearly :slight_smile: but as build big city , skyscrapers ? also their divide?

If you’re going mobile you want to keep the costs of everything down, so yes, you want to keep it as low as possible but still high enough to look good. But that’s where Normal maps come into place to give it that High detail look.

All i can reallly say is start learning and you’ll get it. It won’t happen over night, but it will come to you eventually with dedication.

Breaking your mesh up into smaller pieces should improve performance, even if you don’t convert each individual piece into a box collider (or other primitive shape). Breaking the mesh into pieces will allow only those triangles which are actually near your object to be tested for collisions.

1 Like