- Home /
Flamethrower help
I'm creating a fps game I've created and scripted guns, but I have some trouble, I want to make a flamethrower that will create fire instead of throwing flames? script:
var projectile : Rigidbody; var initialSpeed = 20.0; var reloadTime = 0.1; var flames = 20; private var lastShot = -10.0;
function Fire () { // Did the time exceed the reload time? if (Time.time > reloadTime + lastShot && ammoCount > 0) { // create a new projectile, use the same position and rotation as the Launcher. var instantiatedProjectile : Rigidbody = Instantiate (projectile, transform.position, transform.rotation);
// Give it an initial forward velocity. The direction is along the z-axis of the missile launcher's transform. instantiatedProjectile.velocity = transform.TransformDirection(Vector3 (0, 0, initialSpeed));
// Ignore collisions between the missile and the character controller Physics.IgnoreCollision(instantiatedProjectile.collider, transform.root.collider);
lastShot = Time.time; flames--;
} }
do I just remove the
var initialSpeed = 20.0;
and the
// Give it an initial forward velocity. The direction is along the z-axis of the missile launcher's transform. instantiatedProjectile.velocity = transform.TransformDirection(Vector3 (0, 0, initialSpeed));
?
How do you mean create fire ins$$anonymous$$d of throw flames? If you take out those lines your projectile will be spawned and stay still (unless your rigidbody has gravity in which case it will fall)
Have you tried holding down a button, while incrementing a varaible and gradually increase/decrease a particle size? Just a suggestion :)
Your answer
Follow this Question
Related Questions
Gun Firing help? 2 Answers
FPS one hands/arms model with multiple weapons/guns models 1 Answer
using ironsights wont work standing still 0 Answers
Bullets going wrong direction 1 Answer
Advanced FPS shooting 1 Answer