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\$
5
  • \$\begingroup\$ Have you tried using multiple colliders, combined to make the shape you want? \$\endgroup\$ Commented Sep 28, 2018 at 18:28
  • \$\begingroup\$ Multiple box collider? Hmm.. not yet. I thought there was some way to have a perfect collider. \$\endgroup\$ Commented Sep 28, 2018 at 18:34
  • \$\begingroup\$ Don't hope for perfection in gamedev, just good enough. ;) \$\endgroup\$ Commented Sep 28, 2018 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\$ Commented Sep 28, 2018 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\$ Commented Sep 28, 2018 at 19:40

1 Answer 1

-1
\$\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\$

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.