Unity 3d(Space) Questions

Hey everyone got some questions and yes I know Im total noob…

  1. How can I improve my ship movement script? It seems a bit buggy when turning for some reason almost like bending space but its ok I guess…also how can I tilt the ship slightly when turning? I am going for a STO style ship control system thing.

    using UnityEngine;

    using System.Collections;

    public class ShipControl : MonoBehaviour {

    public Transform ship;
    float flyingSpeed = 0;
    float turnSpeed = 50.0f;
    
    void Update ()
    {
        //Accelerate the ship using the thrust key.
    
        if(Input.GetKeyDown("e"))
        {
            if(flyingSpeed == 0)
            {
                flyingSpeed = 2.5f;
                ship.transform.Translate(0,-flyingSpeed * Time.deltaTime,0);
            }
            
            if(flyingSpeed == 2.5f)
            {
                flyingSpeed = 5f;
                ship.transform.Translate(0,-flyingSpeed * Time.deltaTime,0);
            }
        }
    
        //Decelerate the ship using the thrust button.
    
        if(Input.GetKeyDown("q"))
        {
            if(flyingSpeed == 5f)
            {
                flyingSpeed = 2.5f;
            }
    
            if(flyingSpeed == 2.5f)
            {
                flyingSpeed = 0;
            }
        }
    
        if(Input.GetKey("w"))
        {
            ship.transform.Rotate(20.0f * Time.deltaTime, 0.0f, 0.0f);
        }
    
        if(Input.GetKey("s"))
        {
            ship.transform.Rotate(-20.0f * Time.deltaTime, 0.0f, 0.0f);
        }
    
        if(Input.GetKey("d"))
        {
            ship.transform.Rotate(0.0f, turnSpeed * Time.deltaTime, 0.0f * Time.deltaTime, Space.World); //and then turn the plane
        }
    
        if(Input.GetKey("a"))
        {
            ship.transform.Rotate(0.0f, -turnSpeed * Time.deltaTime, 0.0f * Time.deltaTime, Space.World); //and then turn the plane
        }
    
        ship.transform.Translate(0,-flyingSpeed * Time.deltaTime,0);
    }
    

    }

  2. Edit: Solved!

  3. Edit: Solved!

  4. Is there a way I can make two ships collide by just making a collision sphere on both that detect each other? I don’t need all the fancy physics, using transform for movement currently.

2.) Try Spacescape – Alex Peterson

3.) Lots of possible approaches: simplest is to create a new sphere gameobject, use a semitransparent, emissive material (to give a “glow”), make it a child of your spaceship object and centre it by setting x,y,z translation to 0

4.) Yep - attach a sphere collider and rigidbody component to each ship, but select “is kinematic” because you’ll be moving them yourself. Then you can write code that listens to the OnCollisionEnter () event