Hello, I'm making a medieval first person shooter, similar to the usual FPS but a magic wand instead for a gun, fireballs instead of bullets.
The fireballs are not as fast as bullets, so creating a prefab that travels with a medium speed and makes damage on collision is the best idea I can think of.
The problem is, i can't make the fireballs come of the wand to go to the center of the screen where the GUI for the cross that shows where the fireball will hit(i forget its name).
This is the script, I attached the script to an invisible cube, so the fireballs get created at the top of the want and go forward, but the problem is they go to a different direction everytime
var fireBall : Rigidbody;
function Update () {
if (Input.GetButtonDown("Fire1"))
{
Instantiate(fireBall, transform.position, transform.rotation);
fireBall.AddForce(Vector3.forward * 10);
}
}
![alt text][1]
PLEASE HELP ME FIND A CORRECT WAY TO DO IT
Thank you
[1]: /storage/temp/13333-screenshot_6.jpg
↧