I was using:
float thrust = Input.GetAxis("Vertical") * MainThrust;
To control the spaceship. Problem is that this code allows me to apply force into opposite direction with a equal amount of force.
So I decided to modify the code and let the force “UP”(y-axis) to be 100% of “MainThrust” and “Down” (y-axis) 20% of the “MainThrust”
Here is my current code: (I am getting a compiler error even though I commented the codes that I think its causing the problems)
using UnityEngine;
using System.Collections;
public class LMPhysicsScript : MonoBehaviour
{
public float EnterySpeed = 10;
public float MainThrust = 20F;
public float RollThrust = 1F;
void Start ()
{
rigidbody.velocity = new Vector3 (EnterySpeed,0,0);
}
void Update ()
{
//float thrust = rigidbody.AddForce(Vector3.up * MainThrust);
float rot = Input.GetAxis("Horizontal") * RollThrust;
rigidbody.AddForce(transform.up * thrust);
rigidbody.AddTorque(0,0,-rot);
Debug.Log (thrust);
}
}
// float thrust = Input.GetAxis("Vertical") * MainThrust;
// float rot = Input.GetAxis("Horizontal") * RollThrust;
// rigidbody.AddForce(transform.up * thrust);
// rigidbody.AddTorque(0,0,-rot);
// Debug.Log (thrust);
At the very bottom outside the public class I have commented the code that worked.