- Home /
[Solved] Generating Particles with Attack Animation
Okay, I've got a model which consists of an attack animation, what I was wondering is, how can I generate a 'sphere' consisting of particles from the moment the user hits fire, and when the user lets go of the fire button, it releases the sphere and continues down the path which was specified (similar to raycast). I am a bit confused on this part.
If anything, a point in the right direction would be much appreciated!
Thanks!
Answer by Kaze_Senshi · Apr 07, 2012 at 04:17 AM
Well, I think you should something like this, attach one script like this in one new prefab, this prefab is your fireball. Also this prefab must have a particleEmitter to simulate the fire:
var chargingFireBall = true;
var fireBallEmitter : ParticleEmitter = null;
function Start()
{
fireBallEmitter= gameObject.GetComponent (ParticleEmitter);
}
function Update()
{
if( Input.GetButton("Fire1") && chargingFireBall )
{ fireBallEmitter.maxEmission += 0.1*Time.deltaTime; } //Increase the fire being created
else // ends the charging time and release the ball
{
chargingFireBall = false;
shootFireBall();
}
}
function shootFireBall()
{
/* Make your fireball move, you can use waypoints */
}
Details about emitters here http://unity3d.com/support/documentation/ScriptReference/ParticleEmitter.html
Thanks for this! It's helped. I do have a question though regarding the "make your fireball move" the waypoint part. Is there anyway I can make it just follow where ever the user has clicked?
Your answer
Follow this Question
Related Questions
Can someone help me with my script? 0 Answers
A node in a childnode? 1 Answer
wait for audio to be finished than advance 2 Answers
Enemy not getting hit (Collider issue) 2 Answers
How to create dynamic array of type GameObject using javascript? 2 Answers