breakablemodel - eisclimber/ExPresS-XR GitHub Wiki
Class in ExPresSXR.Minigames.TargetArea
Inherits from UnityEngine.MonoBehaviour
Allows the visual destruction of an object by showing different models and/or using a material to change it's appearance.
This system can be used for tearing down wall to reveal something or sculpting something from stone.
Bear in mind that this is not about being physically accurate but rather about to revealing different versions of a model,
allowing you to break the model. This however requires you to make the model though.
As a an example shader for breaking" the texture you can use the "Breakable Stone Shader" in ExPresS XR's shader folder.
public class BreakableModel : MonoBehaviour| Name | Description |
|---|---|
| OnDamage | Emitted with the current damage when damaged. |
| OnFirstDamage | Emitted when damaged the first time. |
| OnLastDamage | Emitted when damaged the last time (i.e. destroyed). |
| Name | Description |
|---|---|
| DecreaseDamage() | Decreases the damage by one. |
| DisableModelVisualsDelayed(float) | Disables the visuals of all models after a given period of time. |
| DisableVisuals() | Disables the visuals of all models. |
| IncreaseDamage() | Increases the damage by one. |
| ResetDamage() | Resets the damage. |
| Name | Description |
|---|---|
| CurrentDamage | Current damage. |
| MaxDamage | Maximum possible damage. Make sure that the value can be reached with the your setup of TargetAreas. |