- Home /
Firing flame balls with animation and particles
I'm a beginner in unity and in programming the C#. I have a wizard with a moving script and a camera rotation script And i don't know how to make him shoot a flame balls that explode with animation I already have the animation but don't know how to write a script for firing the flame ball and playing the animation . If anyone can help me ,please answer the question.
If you're a beginner you should probably try to go for simpler stuff. If you're still interested, look for info on trigger colliders, OnTriggerEnter, Particle Systems and Rigidbodies. Also you should familiarize yourself with most common Unity components.
Also you should probably start with 2D stuff, since 3D is quite more complicated.
Answer by sparkinfo · Sep 05, 2016 at 09:29 AM
you need to create a particle system using the particle system gameobject that will look like your flame ball. then you make it a prefab and use Instantiate function to make it appear ingame. then you can make that instantiate trigger on any desired input like when you press the shoot key.
Answer by Benjames · Sep 06, 2016 at 04:12 AM
Yeah under a tab in the particle system there is an option for animated particles the animation has to be an animation strip. There are many ways to simulate a fireball, you don't have to start with simpler stuff and you don't have to start with 2D.
If you wanted to code the animation onto a plane or other 3d object you could make a public Texture2D[] array or List<>() add single images of the animation to the list. Then on void Update you could write something like gameObject.GetComponent.material.maintexture=texturearray[slot]; slot++; if(slot>texturearray.Count-1){ slot=0; } but dont actually use GetComponent every frame like that it's slow lol get the renderer at start frame and store it in a variable or better yet make a public Renderer variable and drag and drop it in your editor.
Your answer
Follow this Question
Related Questions
gun ammo script 2 Answers
Problem with AIM to SHOOT script 1 Answer
Hold Button Shooting 3 Answers
Firing System with two Shoot Points 1 Answer
Trouble with script to fire a bullet from a handgun 1 Answer