1
\$\begingroup\$

I have a box with a hole in it. Is it posible to add a collider only to the dark blue showed at the img? (But only at the borders, not a box collider. Let's say i want some object to get in the box, but cannot touch the blue bars). And how to?

enter image description here

\$\endgroup\$
  • \$\begingroup\$ Have you tried using multiple colliders, combined to make the shape you want? \$\endgroup\$ – DMGregory Sep 28 '18 at 18:28
  • \$\begingroup\$ Multiple box collider? Hmm.. not yet. I thought there was some way to have a perfect collider. \$\endgroup\$ – ziad.ali Sep 28 '18 at 18:34
  • \$\begingroup\$ Don't hope for perfection in gamedev, just good enough. ;) \$\endgroup\$ – DMGregory Sep 28 '18 at 18:36
  • \$\begingroup\$ haha alright :) What if the shape is a little more complex and not 'boxy'. How can i make good enough without using those basic shapes like box collider, sphere etc.? \$\endgroup\$ – ziad.ali Sep 28 '18 at 18:44
  • \$\begingroup\$ How are you defining your border? That will tell you a lot about how to go about implementing a collider. \$\endgroup\$ – eclmist Sep 28 '18 at 19:40
-2
\$\begingroup\$

Yes you can.

  1. First make a plane of shape of the blue border which you want.

  2. Add collider to it.

  3. Now create a box and place it to the plane so close that both plane and box look like one single object. Don't add any sort of collider to object.

  4. Save it as a prefab. So that you can use it later as well.

Note: Make the plane and the box object in an empty game object.

\$\endgroup\$

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.