Change rigid body rotation

Hey, I’m kind of new in unity and I’m having problems in changing the rotatation using GetComponent (). Something.
I already have like, when the rectangle hits a cube, it changes its position to the right, and I want to change its rotation too.
Thanks

If you want to ‘teleport’ the rotation of the rigidbody then you can use Rigidbody.rotation

But if you want it to be kind of smooth then you can use Rigidbody.MoveRotation