How to rotate an object

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?

Recreate your prefab as an empty, which has your 3D model as a child.
Rotate the child (the 3D model), not the parent (the empty), how you want, and then use a prefab of the whole thing as your bullet.

I guess you are using a prefab for the bullet?

Take the prefab in the scene and make sure the Blue arrow (Z Axis) is pointing the correct direction and rotation you want the bullet to go

Example something like this :-

75756-screen-shot-2016-08-09-at-111750-pm.png

75757-screen-shot-2016-08-09-at-111805-pm.png

if not then you have to make a new bullet with the blue (Z Axis) pointing correct direction

Im saying ‘Z’ here because in your script , in the vector3(X,Y,Z) you have set the speed variable on the Z position (0,0,speed) which is X=0 , Y=0 , Z = Speed variable

P.S Sorry for my noob explanation :stuck_out_tongue: