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?
\$\begingroup\$ \$\endgroup\$
5 - \$\begingroup\$ Have you tried using multiple colliders, combined to make the shape you want? \$\endgroup\$DMGregory– DMGregory ♦2018-09-28 18:28:10 +00:00Commented 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\$ziad.ali– ziad.ali2018-09-28 18:34:54 +00:00Commented Sep 28, 2018 at 18:34
- \$\begingroup\$ Don't hope for perfection in gamedev, just good enough. ;) \$\endgroup\$DMGregory– DMGregory ♦2018-09-28 18:36:42 +00:00Commented 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\$ziad.ali– ziad.ali2018-09-28 18:44:03 +00:00Commented 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\$eclmist– eclmist2018-09-28 19:40:48 +00:00Commented Sep 28, 2018 at 19:40
Add a comment |
1 Answer
\$\begingroup\$ \$\endgroup\$
Yes you can.
First make a plane of shape of the blue border which you want.
Add collider to it.
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.
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.
