Getting direction of object and add force in that direction 4.1.3

Godot Version



Coming from Unity Im used to using something like
direction = (transform.position - lastpos).normalized to get the direction my object is moving. How would I accomplish this in gdscript? Im currently lerping an object to a target Vector3 and at its end point am trying to add force to the objects rigidbody3d in the direction its traveling.

RigidBody2D has linear_velocity variable. You can do

direction = linear_velocity.angle()