|Attention||Topic was automatically imported from the old Question2Answer platform.|
I have this code:
func _integrate_forces(state: Physics2DDirectBodyState) -> void: if reset: var tr = state.get_transform() tr.origin = some_pos position = some_pos tr.rotated(some_rot) state.set_transform(tr) reset = false
With this code, I can set the position of Rigidbody2D to some_pos. For some reason, I have to set the origin and the position itself to the pos, or else it will teleport back (why?). But it works. However setting the rotation of a Rigidbody2D does not work. It just resets itself to the last rotation. Any help?