How to change scale in func _integrate_forces(state) in the state object

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By DavidPeterWorks

Hi

I would like to change the scale of the state object of the rigidbody2d inside func _integrate_forces(state):

How would you do that?

I want to flip my rigidbody on y axis.

I tried this but it is not perfect.
state.transform = state.transform.scaled(Vector2(-1,1))

Using the scale changes the thing only for 1 frame. It seems something overwrites my changes.

Thank you.