Creating a shatter prefab
One of the challenges of creating VR applications is creating realistic effects, such as the destruction of GOs. In this section, we will explore how to create a ShatterParticles
prefab in Unity to simulate the destruction of a GO. We will go through the steps involved in creating this effect, including creating a C# script, adding Rigidbodies and colliders, and distributing the particles in a variable area. We will also learn how to make variant ShatterParticles
prefabs that can be used in different contexts. By the end of this book, you will have a solid understanding of how to create realistic destruction effects in your VR applications using Unity.
To create a prefab that simulates the shattered destruction of a GO, follow these steps:
- Create an empty GO and name it
ShatteredParticles
. - Create a new C# script and name it
ObjectDestruction
. - Open the script and apply the following namespace:
using UnityEngine;
- In the
public class ObjectDestruction...