RigidBody2D box flipping when put down, abs() not working.

Godot Version

4.4.1

Question

I am making a 2D platformer game, in this game there is a box that I can pick up and move around. However, when I put the box down, it sometimes flips. It works fine if you put it down facing the same way that you picked it up, but if you turn and then put it down it flips. It is crucial for my game that it places correctly.

This appears to be because the current_scale.y changes to a negative number, so I tried putting an abs() around it, but it still gave a negative number. I managed to get it to give me a positive number, but it still doesn’t work.

It is probably easier to understand if you can actually see it, so here is the link to the GitHub repository.