- Home /
How to make 3D colliders on sprites?
I'm making a 2D beat-em-up and doing some camera trickery to make everything look OK. I'm trying to establish a "floor" for my character to walk on, and I'm attempting to make a collider to surround the floor with. Of course, like everything else I've been doing in Unity as of late, I just can't catch a damn break. I'm extremely frustrated at my inability to solve something so simple, but I just don't know what else to do.
I bought the 2DColliderGen utility, and it is able to make a mesh collider that fully encapsulates my sprite. However - and this is the reason for my rage - IT DOESN'T COLLIDE WITH MY CHARACTER'S BOX COLLIDER UNLESS I MAKE IT CONVEX. This is important, because making the collider convex completely changes its shape and it is no longer representative of the sprite I am using. I've read dozens of posts about how mesh colliders only work against other mesh colliders if they are convex, but this is a case of a box collider failing to detect a mesh collider. Upon further investigation, I have discovered that my mesh collider isn't actually fully 3D - it only encompasses the perimeter of my sprite. I want something that completely wraps around the sprite - the ideal case is a collider that is a slightly extruded version of the sprite itself. As far as I can tell, there is absolutely nothing in the 2DColliderGen that is capable of doing this.
I don't want to go and blow more money in the Asset Store yet because I'm thinking there's a way to do this. I've tried the free UCLA Mesh generator, but this also doesn't work - it will create a usable mesh that collides, but it always changes the scaling such that it isn't 1:1 with my sprite. I swear to God, it's always something.
Somebody, anybody, if you have experience with this I am begging for your help. I'm seriously on the verge of giving up because it feels like the stupidest things are constantly holding me back.
do you need to generate the collider procedurally? if not, why don't you just create mesh for it?
edit: i found this question as i am trying to make mesh collider out of sprite's mesh, when it's not the tight setting's it works perfect, when it's tight, there's problem with UV mapping, however the collider works, but it's not convex ... it has maximum of 255 triangles and it's pretty hard math to do it automatically ... so i suggest: do the mesh manually if you can
Your answer
Follow this Question
Related Questions
How do you bend a 2d texture in 3d?,How do you bend a 2D object in 3D? 0 Answers
3d collider mesh to 2d collider mesh 0 Answers
How to flatten 3d image STL to 2d 0 Answers
Draw/generate shape as 2D sprite? 0 Answers
2d sprite characters in a 3d game 1 Answer