Hey there! I want to make destruction physics similar to Jujutsu Shenanigans. How do I do that? Must I make each wall / part into 1x1 cubes and have their welds destryoed? That doesn’t seem very optimized. I also want it done via the server too.
I’ve found these and there are many more! Please search before creating a post, and good luck!
I did search before creating a post. None of these “solutions” have actually helped me.
Although when I search about voxels, the only one that comes up is VoxBreaker. I have found Voxel Physics though a tedious google search, but the other ones are ghosts for me.
Oh well shoot.
This one is exactly about your post, just read what they said that allowed them to do it, and then you can use your already existing scripting knowledge to create it in theory. They even have code examples in the solution to help
I would recommend you just use VoxBreaker or something like @FroDev1002 suggested, as creating your own voxel system from scratch is really complicated, especially when you consider the math you’d have to do, not to mention optimizing it yourself.
I was talking in a development discord server earlier today and one person literally said chatgpt managed to write it for them perfectly. If chatgpt is able to flawlessly do this then I have a feeling you’re doing a bad job at research.
this is a good solution
you can slice parts with CSG and its very fast
Creator of VoxBreaker here. Like @FroDev1002 said, you can use the previously mentioned forum post which I used to create voxbreaker. Or, you can look through the documentation and source code of VoxBreaker if youd like, which ive commented on extensively in the event of people curious about how the system actually works. Or, you can look through the voxel physics module as an alternative. And if all else fails, you can just ask me for specifics on either here or discord. There is a bit of a lack of resources on this topic so id like to share as much as I can.
There are different ways of making a voxel destruction system. all having different pros and cons.
Afew ways you could achieve this destruction type are:
CSG 🟡
Creating a premade sphere-shaped ball and positioning it to the thing you want to destroy and aligning the sphere to a grid to match the voxels.
Pros: Can be performed on most parts,
decently fast.
Cons: Too much union operations can get heavy on the server and after a while, could cause some performance issues.
Welds 🟢
Creating your builds/Environment out of cubes and welding each cube to the nearby/connected cubes. And then you would be able to un-weld the cubes you want to destroy and apply a small force to them to make them fall.
Pros: You get basic destruction…
Cons: Performance issues,
You have to make your game out of mini cubes,
You have to connect each cube with a weld.
Editable meshes 🔴
Boring and probably over simplified explanation
Create models out of mini cubes and make a script or plugin to convert them into an editable mesh whilst keeping the data of the cubes it’s made of; position, nearest cubes, ect.
To destroy part of the model, Grab the nearest cubes within a range of the position (using the cubes data from the mesh) and remove them from the mesh. (Delete their triangles and fill the missing faces for the cubes besides the removed cube)
And for debris you can fill the missing space with voxels and use a (fill simulation) to split the debris part into different sections and making them their own part. (example fill here)
And then u can unanchor the derbis and add some forces to it, so it falls.
This is a very dumbed down explanation
Pros: Performance, this would technically be depended on how you script it, but overall, I would say this would be the best in performance.
Would look very nice compared to the other options.
Because its more customizable, you would be able to better optimize it. The other options aren’t really that customizable which could be a limit to you.
Cons: You would have to make the world out of voxels and convert it for every change. (basically)
Editable meshes are not released in games yet, so you wouldn’t be able to public or make the game playable for public until it gets rolled out of beta.
Im sure theres more ways to do this, but these are the ways i thought of.
VoxelDestruct | Voxelated destruction physics with greedy meshing, hitboxes, and more!
Resources always exist, does take a bit of digging to find sometimes!