- Home /
simple explosion animation
Hello!
I need to do a simple explosion animation when i touch a cube, how can i do? I have this function to destroy the cube.
if (Input.GetMouseButtonDown(0)) { Ray ray = GetComponent().ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit)) { Destroy(hit.collider.gameObject); } }
Thanks!!
What do you mean when you touch the cube? run into it with your player or when you do the raycast on it.
Answer by Jwizard93 · Jul 11, 2017 at 03:19 AM
Get an explosion from the asset store. plenty of free ones. Get one that comes as a prefab and then instantiate it in the same place you destroy the cube.
Your answer
Follow this Question
Related Questions
Explosion using an animated sprite? 1 Answer
How can I play an explosion animation? 3 Answers
Player won't stick to moving cube 2 Answers
what to do to get the explosion animation of an object 1 Answer
Dataset is null 1 Answer