Search Unity

Space Shooter Tutorial - Transform Direction

Discussion in 'Editor & General Support' started by N1ghtrunner, Mar 8, 2015.

  1. N1ghtrunner

    N1ghtrunner

    Joined:
    Jan 5, 2015
    Posts:
    104
    I've been following along to the Space Shooter tutorial and enjoying it quite a bit. I hit my first snag on part 7, where we create a bolt. I noticed that when creating the collider, the tutorial sets it to z-axis. However when I do this, the collider shape does not fit the bolt. So I leave mine set to y-axis.

    When I launched the game, I noticed the bolt would appear on screen for a second, then dissapear. I'ts y and z axis values continue to change, so it's clearly off camera and moving around. I've had to change my code so that instead of using transform.forward, I'm using transform.up, and its working fine now.

    I cant work out why I would be having this issue/difference to the videos. I'm sure its quite simple, but very keen for the answer. Any ideas here? Here is the code:

    using UnityEngine;
    using System.Collections;

    public class Mover : MonoBehaviour
    {
    public float speed;
    void Start ()
    {
    rigidbody.velocity = transform.up * speed;
    }

    }
     
    IvanS95 likes this.
  2. tadmuck

    tadmuck

    Joined:
    Sep 26, 2014
    Posts:
    1
    I'm having the exact same problem! Please post if you figure this out!
     
  3. IvanS95

    IvanS95

    Joined:
    Aug 29, 2017
    Posts:
    4
    Same here! How is it that nobody has gotten a fix for this already?