Answer the question
In order to leave comments, you need to log in
How to implement the destruction of a 2D object?
Greetings.
Perhaps one of the only answers that I could not dig up in a search engine. Destructibility of 2D objects. For example, cutting a tree like in Terraria, or if you imagine a Box, and after hitting it, destruction into small pieces that disappear afterwards. Can anyone explain the principle of implementing this system on the Unity engine? I understand everything with a crutch, and I work more not through the code, but through the engine itself) For example, in my understanding it is:
There is a character with a trigger for Hit, when the trigger is activated and the hand touches with a collision (for example) Barrels, then the Barrel object is destroyed by Destroy (col.gameObject); after which a certain system of particles is activated, producing the ejection of pieces once. I'm sorry , I just don't have much experience, so I'm writing here to find out the answer)
An example from the Sword of Xolan game:
Answer the question
In order to leave comments, you need to log in
For destruction, separate objects (prefabs) are created with destruction animation. After, for example, a barrel is destroyed, the object of the barrel is removed/hidden, and in its place an object is created with the animation of the destruction of the barrel.
And the animations themselves are already being done depending on the situation: you can simply draw several changing frames with the state of the object, or you can do it with particles.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question