Search Unity

  1. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice

how to make my bullet point to the front of my ship?

Discussion in 'Scripting' started by lucasmees, Oct 19, 2014.

  1. lucasmees

    lucasmees

    Joined:
    Sep 21, 2014
    Posts:
    18
    I'm trying to find an example that fits with my problem , but when I shoot the bullet only goes to a certain point .

    And the strange thing is that out instead of going straight in the Z plane she will reverse .

    I see here how does one use the LookAt , but I need it to do with the bullet shoot as a weapon .

    var velTiro: int = 10; //speed shooting
    var lookNave = Vector3.forward; //variable receives the position of the Z axis of the ship
    function Start () {
    }

    function Update () {



    transform.rotation.x = 90;
    transform.rotation.y = 0;
    transform.rotation.z = 0;

    //transform.LookAt(Vector3.zero);
    transform.Translate(0,0,velTiro * Time.deltaTime);
    Destroy(gameObject,3);
    if (Input.GetKeyDown("space")){

    }

    already tested with : transform.Translate(0,0,velTiro * Time.deltaTime);
    but the bullet only goes down .