6
\$\begingroup\$

How can I make a hole in an object with Unity 3D? I've something like this object and I want to make a hole in it.

\$\endgroup\$
  • 6
    \$\begingroup\$ Do you wish to make the hole in the editor or during gameplay? Unity does not have a built-in feature for the former, nor an easy function for the later. However, both can be achieved via code. \$\endgroup\$ – MAnd Dec 28 '15 at 17:37
  • 2
    \$\begingroup\$ Do you want any old random hole in it or a distinct predefined hole at a specific location? \$\endgroup\$ – Steven Dec 28 '15 at 21:29
4
\$\begingroup\$

You can't. Unity does not have CSG modeling options. You're going to either:

  1. construct your cylinder out of smaller parts
  2. model it in another program
  3. programmatically rebuild the mesh geometry at runtime. WARNING: ADVANCED TOPIC
\$\endgroup\$
  • \$\begingroup\$ In the advanced topic helm, there is also the option of coding a script to add that function to the editor. \$\endgroup\$ – MAnd Dec 28 '15 at 17:38
  • \$\begingroup\$ @MAnd true enough, and I've used one such tool. It was a pain in the arse to use (at least, the free version, which lacked a number of features). I'd categorize that as an "advanced topic" even within the advanced topic. \$\endgroup\$ – Draco18s Dec 28 '15 at 17:50
5
\$\begingroup\$

Not directly. But there are several ways to achieve this:

  1. Use a voxel engine. Then you can have objects that has some kind of "molecules". You can deform them in runtime.

  2. This Unity plugin.

  3. You may build your object in parts, and then attach them together in Unity, so you can create a hole by simply removing the part in the middle.

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