- Home /

# What is the rotation equivalent of InverseTransformPoint?

from the docs: "Transform.InverseTransformPoint transforms position from world space to local space."

[*some gnarly equation that's a mystery to me?*] transforms rotation from world space to local space.

There is no such thing as Quaternion.InverseTransformRotation, but if there were, that would be exactly what I'm looking for. It's also what happens automatically to the localRotation when you parent an arbitrarily rotated object to some other arbitrarily rotated object, but there has to be a better way than actually parenting and unparenting objects every frame...?

**Answer** by Steven-1
·
Aug 11, 2015 at 09:16 PM

What Owen said is almost correct. The correct formula is:

```
Quaternion LocalRotation = Quaternion.Inverse(Target.transform.rotation) * WorldRotation;
//this will transform WorldRotation to Target's local space
```

How would that work the other way, local to world rotation?

I think this?

```
Quaternion WorldRotation = Target.Transform.rotation * rotation;
//Transforms rotation from Targets local space to world space
```

`Quaternion worldRotation= transform.parent.rotation * localRotation;`

I could get world rotation from local like this;

I ran into this problem with ParticleCollisionEvent.normal. I wanted to instantiate an object and physicaly connect it to an object that collided with a particles from a particle system. ParticleCollisionEvent uses world position and rotation . If the object with the collider collided with the particles from a different angle the object attached to it would be at the wrong angle. after spending all day trying, I came up with thisQuaternion.LookRotation(particleCollisionEvent.normal) * Quaternion.Inverse(transform.rotation.normalized) . Then I wondered if there was a world-to-local method for rotation and google brought me to this thread found the same answer.

**Answer** by Owen-Reynolds
·
Jun 27, 2012 at 05:02 PM

Only partially tested: the local rotation from object P seems like it's your world rotation "minus" P's rotation. The opposite of a rotation is the Inverse, so:

```
Quaternion localRotFromP = transform.rotation * P.rotation.Inverse();
```

As a check, when you use local to get world, you multiply by the "parent" rotation. If we do that to our computed local, we get `trans.rot * P.rot.Inv * P.rot`

. The last two terms cancel (Quat mult isn't commutative, but is still associative) and you get your real rotation back.

shouldn't it be the other way? Quaternion localRotFromP = Quaternion.Inverse(transform.rotation) * P.rotation;

### Your answer

### Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.

### Follow this Question

### Related Questions

Quaternions local/world 1 Answer

Random.rotationUniform clarification 4 Answers

Trouble with Camera Rotation Math 2 Answers

Camera viewport transformation from one world to the rotated world. 1 Answer

Ellipse Animation by code 2 Answers