Is slicing parts possible now?

Greetings. So I just heard that this might be possible to do now, does anyone know if this scenario is possible:

Say for example we have, I don’t know, a potato consisting of multiple parts in a model. Now let’s say, the player has a knife to cut that potato into multiple pieces. The potato is then sliced depending on where the player’s knife hits the potato.

I thought I heard Roblox adding some new service or what-not that works for these kinds of procedures. Is what I just said possible to do without heavy mathematics? And if that’s so, any example on, maybe not this exact thing, but perhaps something similar would be awesome, as I could mess around with it.

Thanks!

3 Likes

Yes, you can create unions in real-time. This was announced some time ago.

(Edit: Link ninja’d by below.)

3 Likes

Csg api lets you use unions and negations in game. You could cut up a potato made of parts or a union potato, but not a complex one with many triangles, or a mesh.
(Edit: I was typing first!)

3 Likes

Oooh I see. That’s cool! Thanks for the replies, guys.

I’m a complete noob when it comes to this service though, as I’ve never learned to use it. Does anyone have any simple example code for say, how to slice a rectangular brick union into two halves? Or just something simple so I could see how this works.

1 Like

I actually do not. Depending on your use case, you could end up with something relatively complicated though.

If you want a potato sliced in half, I would suggest a workflow like this:

  • Clone the potato so you have two of them
  • For each half, create a part that is half it’s width (or length) and position it so it takes up half of the potato
  • Subtract the throwaway parts from each potato
  • Now you have two halves
2 Likes

Oh okay. Thanks! :slight_smile:

Devhub article for further reading.

4 Likes