I have a problem with a script. I am making a FPS Game and i have a spawn bullet script. It’s pretty simple, but it does what it was supposed to do. At least most of it…
I want to spawn a cilinder and then make it go, you know, like “fly, you are free”. I am glad that everything works fine, except that it’s pretty unconfortable to see your bullet fly inverted =|
When it spawn, it is inverted. Not that it goes backward, but it is pointed up, when it was supposed to be pointed to the sides. The image explains everything.
Here’s my script:
using UnityEngine;
using System.Collections;
public class ShootTime : MonoBehaviour {
public Rigidbody projectile;
public float speed = 0;
public float fireRate = 0.5F;
private float nextFire = 0.0F;
void Update()
{
if (Input.GetButton("Fire1") && Time.time > nextFire)
{
nextFire = Time.time + fireRate;
Rigidbody clone = Instantiate(projectile, transform.position, transform.rotation) as Rigidbody;
clone.velocity = transform.TransformDirection(new Vector3(0, 0, speed));
}
}
}
What can i do to change the bullet so it spawn like… A BULLET. And still nothing changes in it’s aerodynamics/direction?