Portal-like Rotating

Hello, I’ve recently started a gravity switching puzzle game. One of my ideas was to allow the player to switch their gravity then walk on different walls. I have been struggling with getting the actual rotating to work but after playing Portal (the first one) again I realized that upon exiting a portal your player does the rotation that I am wishing to achieve. I have tried every method I could find or think of, attempted to use the scripting reference examples but to no avail. I have had rotating work but then my mouse look script messed it up and I could not find a way to disable it while it is rotating, and only when it is rotating. I’m just wondering if any has any ideas of how to achieve this rotating. I’m not asking for full in-depth scripts just one or two lines demonstrating an idea. I could have been using a method incorrectly and then be able fix it that way, I’m just asking for a few ideas as to how this could be created.

TL/DR Ideas for how to rotate a rigidbody player ( I.E. like you see in Portal)

There might be more efficient ways to do this but this one is the simplest and requires minimal code:

  1. Make a gameObject at the 1st portal’s
    transform. Make sure its
    localRotation is 0,0,0.
  2. Attach your player to the gameObject as a child.
  3. Attach your gameObject to the 2nd portal and set its localRotation to
    0,0,0

Voila! Note: You can also teleport your player this way by changing the gameObject’s localPosition to 0,0,0 after you attach it to the 2nd portal.