In games like AoE2, they've used sprites for the buildings and they've handled the collisions very well. How would I achieve something like that in Unity?

Currently, I've tried using box colliders along with the sprite renderer in a child game object. It didn't worked out well though.

  • \$\begingroup\$ I think those games use a 3 dimensional world, but render it with 2 dimensional tiles \$\endgroup\$ – Bálint Jul 21 '17 at 9:36
  • \$\begingroup\$ 2 dimensional tiles? Meaning? \$\endgroup\$ – Haikal Izzuddin Jul 21 '17 at 9:42
  • \$\begingroup\$ They aren't models, they are just sprites basically \$\endgroup\$ – Bálint Jul 21 '17 at 9:51
  • \$\begingroup\$ Right now, we're doing the sprite thing. Just need to figure out how to handle collisions, and pathfinding when using the sprites. \$\endgroup\$ – Haikal Izzuddin Jul 21 '17 at 10:05
  • \$\begingroup\$ @HaikalIzzuddin if gameplay and collisions are handled in 3D space then colliders should be 3D. That is it. I guess 2D colliders don't collide with 3D in Unity. So the answer is obvious. What was your issue with using Box collider? \$\endgroup\$ – Candid Moon _Max_ Jul 21 '17 at 15:19

Finally after doing much research and tests, we came up with a solution.

Custom solution

We've used the same 3d mesh but with the mesh renderer turned off. Overlaying the sprite over the mesh, we've managed to come up with something decent.

The mesh would then work as the collider but without the extra high poly cost. So now, interactions could work perfectly.

|improve this answer|||||
  • \$\begingroup\$ If this worked for you, don't forget to come back & mark the answer "Accepted" \$\endgroup\$ – DMGregory Oct 1 '17 at 21:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.