RigidBody2D box flipping and not placing properly.

help me

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.

It is supposed to keep the same direction and rotation when placed down as it did when it was held, instead it flips it on the y axis, but only if the player turned while holding it and is no longer facing the same way as when they started.

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. I ran out of ideas at that point and turned to ChatGPT, it could not fix it after hours of back and fourth.

It is probably easier to understand if you can actually see it but the code is quite long and the issue requires video, so here is the link to the GitHub repository.

Posted Jun 3, 2025, 7:45 AM UTC

04
Loading comments…