Hello everyone, I hope you’re all having an excellent day,
I’m in a need to add a dash, well, more of a burst of speed, to my spaceship, that could propel it forwards at a higher speed than it is already going at, in it’s forwards direction, regardless of the speed or the angular velocity it has, without it giving me any errors on this script.
public class ShuttleMovement : MonoBehaviour
{
float speedForce = 10f;
float torqueForce = 3f;
public ShuttleMovement()
{
}
// Start is called before the first frame update
void Start()
{
}
void Update() { }
// Update is called once per frame
void FixedUpdate()
{
Rigidbody2D rb = GetComponent<Rigidbody2D>();
if (Input.GetButton("Accelerate"))
{
rb.AddForce( transform.up * speedForce);
}
rb.AddTorque(Input.GetAxis("Horizontal") * torqueForce);
}
}
I can’t seem to get it right.
Cheers.