Using PinJoint to joint rigidbody2D together for the character "player" (the one moving around). You can limit the rotation of the rigidbody2D by attaching an intermediary rigidbody2D (purple and red polygon shape) in between two rigidbody2D as shown in the video. It is not recommended to change the rigidbody2D rotation every time when its mode is set to 'Rigid' because you will be causing some conflict with the physic engine. Remember to 'disable collision' at for the 'pinjoint' in order to restric the rotation.To move the rigidbody2D ('rigid') in the direction it faces:
# example
# assuming the script is attached to the rigidbody2d node
func _integrate_forces(state):
# Vector2(x,y)
# assuming your rigidbody is rotation_degree is equal to 0 (default value)
var speed = Vector2(10,0)
# speed vector will be set to the rotation by "speed.rotated(rotation)"
# apply force
set_applied_force(speed.rotated(rotation))
# to rotate
# clockwise
rotation_direction = 10
# counter clockwise
rotation_direction = -10
set_applied_torque(rotation_direction * 1000)
![](https://i.ytimg.com/vi/o0t5JkmOdas/maxresdefault.jpg)