I have a dynamic mesh which is created and updated dynamically according to the game,and it has many vertices. However when I use it as a mesh for its collider, I get the warning that it has more then 255 polygons. I read it is what slows the game. However the mesh has to be very flexible and growble, and it has to detects collisions. How can I optimize it in runtime foe the collider which has only to have the current approximate shape of it?
0
votes
You could try and use a simpler shaped collider (box, sphere, etc.) or multiple of them.
– Gunnar B.
See following webpage : cs.ucsb.edu/~suri/cs235/Triangulation.pdf
– jdweng
@GunnarB. I can't because my mesh is a moving a growing snake..and it hasn't a static shape..
– SuzLy
Is it growing in a certain direction or in all directions? If only in a certain, you could chain colliders (and maybe scale them up if the mesh does).
– Gunnar B.
its growing from spesific side of it but it can move to any direction in 3D, so that it can have any shape of snake.. @GunnarB.
– SuzLy
1 Answers
0
votes
I would recommend using capsule colliders. When you expand the width of the snake, scale the width of the colliders. When you add length to the snake, add another collider onto the end. This way different parts of your snake can have different sized colliders. Depending on how much the width varies you may need to add more or less colliders to approximate its shape.
But it's always better to have many primitive colliders than one very complex mesh collider.