system
February 22, 2012, 3:11am
1
HEY UNITY PEOPLE DO ANY OF U NOW A SCRIPT FOR 3RD PERSON TO MAKE HIM SHOOT A FIRE BALL OR BULLET OUT OF HIM??
I MEAN LIKE TORNADOTWINS SCRIPT WHERE IT SHOOTS OUT OF THEIR PLAYER
TORNADOTWINS SCRIPT WONT WORK ON THE NEW UNITY 3.5
SO IF ANYONE NOW TELL ME PLEASE
THANKZ FROM CaM
system
February 22, 2012, 8:28pm
2
Assuming I think you just want a simple shooting script when you click then you just do.
var projectile : Rigidbody;
var speed = 50;
var fireRate = 0.11;
private var lastShot = -10.0;
function Update () {
if(Input.GetButtonDown("Fire1")){
if(Time.time > fireRate+lastShot){
clone = Instantiate(projectile, transform.position, transform.rotation);
projectile.tag = "Bullet";
clone.velocity = transform.TransformDirection( Vector3 (0, 0, speed));
lastShot = Time.time;
}
Destroy(clone.gameObject, 3);
}
}
system
February 23, 2012, 3:51am
3
Well the fire ball appears with this script but this is what happens
the fireball appears for like one second and dissapears after anyone else have an answer or fire omega can u help
system
February 24, 2012, 7:48pm
4
assuming you want it to be automatic just change the “GetButtonDown” to just “GetButton” or you could just play around with the fire rate
system
February 24, 2012, 7:53pm
5
Or if you want to stop them disappearing then just get rid of the Destroy line at the bottom
system
July 15, 2014, 7:30am
6
What coding script is that? (JS, C#, Boo?)