HEY GUYS!
I am new to unity that’s why i’m having a hard time getting use to it I am already aware about the basic programming of unity.I wanted to know that how can i create a character who shoots fire ball.I have all the animations like the fire particle affects and the humanoid animations and here’s what i want to know.
1.)how can i attach the fire animations to the humanoid such that whenever the character moves his hand
and does stuff to show that he is shooting the fire ball the fireball appears and moves toward where we have aimed.
2.) the script so that whenever we press the right mouse button the player shoots fire ball which moves ahead and when it collides with the player an animation occurs.
You should tell more about what kind of particles and what kind of animations you have.
I would do it like this, might work for you too if you have a spell cast animation, fireball and explosion particles:
Create an empty object where you attach the particles. Instantiate it as a child of your hand in your humanoid model. Play your fireball particles at the same time when you play your fireball casting animation. Your character should be now casting spell with his hand on fire.
Create and attach a script to object(fireball) you have in your hand. Set a timer that launches your fireball towards the target at the correct time of the animation, or create an animation event to launch the fireball.
Add OnCollisionEnter to your fireball script. When it collides, stop playing fireball particles, play explosion particles, and destroy your game object.
These links should cover most of your needs for your fireball casting:
You can check this tutorial where the player can press a key to let a ninja spawn a knife towards the position he’s facing towards with few extras like throwing a knife while jumping and so on, but I think this tutorial is related to what you are looking for.
You might need to watch other tutorials for the flip parts or the collision with the enemy, etc…
The fireball animation isn’t mentioned though, but if you understand how animation works it’s not that hard to do it.