- Home /
Destructible Walls
I'm creating a shooter and I want to add to it being able to break the walls like in this video(https://www.youtube.com/watch?v=LsgvrAz4Ip4) or as in Rainbow Six Siege
I've already looked at unity assets and the ones they sell are not what I'm looking for, for example Ultimate Fracturing Destruction, it's very good but it's not what I'm looking for. for these assets to work you need a mesh that is already fractured and when we shoot they activate the rigidbody to the fragment giving the illusion that it is being destroyed.
there is also Nvidia Blast which we have this scena(https://unitylist.com/p/l7c/Destructible-Walls) that uses it but to destroy uses the same mechanism, Nvidia Blast takes care of fragmenting the mesh but to fall activates the rigidbody
What I want to accomplish would look something like this
I have come to the conception that if I want to be able to break the wall no matter where I shoot (without using a framentado mesh) it would deform the mesh.
after researching more about cutting the mesh I came in with this video(https://www.youtube.com/watch?v=1UsuZsaUUng&t=1s) but I do not know how to orient it to what I look for would be something like this video where they also cut mesh(https://www.youtube.com/watch?v=4bi3tLzX0Tw)
I thank anyone who wants to help me and explain to me where I could start or what the best way
Answer by Link17x · Mar 14, 2020 at 10:11 PM
So I used Maya to split an object into fragments (very simple, done with a single tool/button, then a few settings to determine how much it should be broken up). I believe Maya requires a license, I have access because I'm a student. But I'm sure there is other software like Blender you could use for free.
Once this is split up, then imported back into Unity, it will be a parent object (the entire object) then it contains X number of child objects (fragments).
The way I did this in the past was by having an interface called IShatter, that would require all objects that implement it to take a force, direction and radius. I set these values in the inspector for each object so some objects would explode more than others i.e. buildings would crumble, whereas benches would go flying into pieces.
internal interface IShatter
{
void Explode(float force, Vector3 direction, float radius);
}
Then I had a parent gameObject for all of the fragments, this would be activated and apply AddExplosiveForce to all of the fragments.
public void Explode(float force, Vector3 direction, float radius)
{
fragmentsParent.SetActive(true);
transform.DetachChildren();
Destroy(gameObject);
foreach (var fragment in m_Fragments)
{
fragment.GetComponent<Rigidbody>().AddExplosionForce(force, direction, radius);
}
}
This is slightly different from what you want because I used very small objects i.e. park benches etc. But I'm sure you could use a similar approach where you have an empty parent object, which contains individual fragments to form an entire object. Then cause some sort of explosive force on each fragment when it is hit by a specific gameObject with a tag i.e. "bullet", otherwise return early so it doesn't explode from the player walking into them or something.
You might notice that I used transform.DetachChildren(); which is so the individual fragment is treated separately from the rest of the gameObject once it is 'hit'.
thank you very much, if in blender it is called Cell Fracture and autodesk this RayFire that is paid but the fragments of the mesh are very large and if I leave them very small and I integrate them into a map would consume a lot.
recently PUBG added a very good destruction system: https://youtu.be/jT1VkCfvJNY?t=21
I'd like where you shoot exactly the circle of the bullet
Another technique I belive games like COD often use is to add/replace textures to the position that was shot.
Check out this video https://youtu.be/s0AhTPwe8fo it could be more of the approach you want to take?
yes but can you paint a texture with transparency? what I want to do is i can break the walls
Your answer
Follow this Question
Related Questions
cloning prosedural mesh,deform mesh and instantiate 0 Answers
Get plain coordinates for another object 2 Answers
Moving an hole in a plane 0 Answers