I've created a sample project here:
https://github.com/imekon/shipthruster
The script I use to move the ship (like in an asteroids game) wobbles when you hit thrust (up):
extends RigidBody2D
const ROTATE_SPEED = 250
const ACCELERATION = 5
var size
func _ready():
size = get_viewport().get_rect().size
set_fixed_process(true)
func _fixed_process(delta):
if (Input.is_action_pressed("ui_spin_left")):
rotate(deg2rad(delta * ROTATE_SPEED))
if (Input.is_action_pressed("ui_spin_right")):
rotate(-deg2rad(delta * ROTATE_SPEED))
if (Input.is_action_pressed("ui_thrust")):
apply_impulse(get_pos(), Vector2(0, -ACCELERATION).rotated(get_rot()))
var pos = get_pos()
if (pos.x < 0):
pos.x = size.x - 1
if (pos.x > size.x):
pos.x = 1
if (pos.y < 0):
pos.y = size.y - 1
if (pos.y > size.y):
pos.y = 1
set_pos(pos)
I'm guessing it's my use of apply_impulse?