# GetPositionAndRotation(out Vector3, out Quaternion)

> Updates the value of the out parameters position and rotation with the transform's current position and rotation in world space (that is, relative to the scene's origin coordinates).

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine](/engine/6000.7/script-reference/unityengine.md)
* **Assembly:** UnityEngine.CoreModule

## GetPositionAndRotation(Vector3, Quaternion)

```csharp
public void GetPositionAndRotation(out Vector3 position, out Quaternion rotation)
```

### Parameters

**** (\[Vector3]\(/engine/6000.7/script-reference/unityengine/vector3)): Out parameter that will receive the position of the transform in world space.**** (\[Quaternion]\(/engine/6000.7/script-reference/unityengine/quaternion)): Out parameter that will receive the rotation of the transform in world space.

### Remarks

**Note**: When getting both the `position` and `rotation` of a `Transform`, calling this method is more efficient than querying to [Transform.position](/engine/6000.7/script-reference/unityengine/transform/position.md) and [Transform.rotation](/engine/6000.7/script-reference/unityengine/transform/rotation.md) individually.

The typical usage for this method is to retrieve a transform's `position` and `rotation` in world space, to either display them or evaluate them. For example:

` transform.GetPositionAndRotation(out Vector3 position, out Quaternion rotation)`

The following example logs the position and rotation of a `GameObject`'s `Transform` in world space.

```csharp
using UnityEngine;

// Attach this script to a GameObject as a component.
public class GetPositionAndRotationExample : MonoBehaviour
{
    void Start()
    {
        // transform refers to the <see cref="UnityEngine.Transform"></see> of the <see cref="UnityEngine.GameObject"></see> this script is attached to.
        transform.GetPositionAndRotation(out Vector3 position, out Quaternion rotation);

        // We will convert the rotation <see cref="UnityEngine.Quaternion"></see> to Euler angles for readability.
        Debug.Log($"{name} is located at {position}, and has the rotation {rotation.eulerAngles}");
    }
}
```

Additional Resources: [Quaternion](/engine/6000.7/script-reference/unityengine/quaternion.md), [Vector3](/engine/6000.7/script-reference/unityengine/vector3.md).
