# TransformPoints

> Transforms multiple points from local space to world space writing the transformed points to a possibly different location.

## Definition

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

## TransformPoints(ReadOnlySpan\<Vector3>, Span\<Vector3>)

Transforms multiple points from local space to world space writing the transformed points to a possibly different location.

```csharp
public void TransformPoints(ReadOnlySpan<Vector3> positions, Span<Vector3> transformedPositions)
```

### Parameters

**** (\[ReadOnlySpan\<Vector3>]\(https\://learn.microsoft.com/dotnet/api/system.readonlyspan-1)): The positions of the points to be transformed, these vectors are not modified by the function unless the transformedPositions span overlaps.**** (\[Span\<Vector3>]\(https\://learn.microsoft.com/dotnet/api/system.span-1)): Receives the transformed positions of each point, must be the same length as positions otherwise an exception will be thrown.  If this span overlaps positions other than representing the exact same elements the behaviour is undefined.

### Remarks

Note that the positions of the returned points are affected by scale. Use [Transform.TransformDirections](/engine/6000.0/script-reference/unityengine/transform/transformdirections.md) if you are dealing with directions.

You can perform the opposite conversion, from world to local space using [Transform.InverseTransformPoints](/engine/6000.0/script-reference/unityengine/transform/inversetransformpoints.md).

```csharp
using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour
{
    public GameObject someObject;

    const int kNumPoints = 100;

    void Start()
    {
        // Instantiate 100 objects to the right of the current object
        Vector3[] points = new Vector3[kNumPoints];
        for (int pointNum = 0; pointNum < kNumPoints; pointNum++)
        {
            points[pointNum] = Vector3.right * pointNum;
        }
        Vector3[] transformedPoints = new Vector3[kNumPoints];
        transform.TransformPoints(points, transformedPoints);
        for (int pointNum = 0; pointNum < kNumPoints; pointNum++)
        {
            Instantiate(someObject, transformedPoints[pointNum], someObject.transform.rotation);
        }
    }
}
```

Additional Resources:[Transform.TransformPoint](/engine/6000.0/script-reference/unityengine/transform/transformpoint.md), [Transform.InverseTransformPoints](/engine/6000.0/script-reference/unityengine/transform/inversetransformpoints.md), [Transform.TransformDirections](/engine/6000.0/script-reference/unityengine/transform/transformdirections.md), [Transform.TransformVectors](/engine/6000.0/script-reference/unityengine/transform/transformvectors.md).

## TransformPoints(Span\<Vector3>)

Transforms multiple points from local space to world space overwriting each original point with the transformed version.

```csharp
public void TransformPoints(Span<Vector3> positions)
```

### Parameters

**** (\[Span\<Vector3>]\(https\://learn.microsoft.com/dotnet/api/system.span-1)): The positions of the points to be transformed, each is replaced by the transformed version.

### Remarks

Note that the positions of the returned points are affected by scale. Use [Transform.TransformDirections](/engine/6000.0/script-reference/unityengine/transform/transformdirections.md) if you are dealing with direction vectors.

You can perform the opposite conversion, from world to local space using [Transform.InverseTransformPoints](/engine/6000.0/script-reference/unityengine/transform/inversetransformpoints.md).

```csharp
using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour
{
    public GameObject someObject;

    const int kNumPoints = 100;

    void Start()
    {
        // Instantiate 100 objects to the right of the current object
        Vector3[] points = new Vector3[kNumPoints];
        for (int pointNum = 0; pointNum < kNumPoints; pointNum++)
        {
            points[pointNum] = Vector3.right * pointNum;
        }
        transform.TransformPoints(points);
        for (int pointNum = 0; pointNum < kNumPoints; pointNum++)
        {
            Instantiate(someObject, points[pointNum], someObject.transform.rotation);
        }
    }
}
```

Additional Resources:[Transform.TransformPoint](/engine/6000.0/script-reference/unityengine/transform/transformpoint.md), [Transform.InverseTransformPoints](/engine/6000.0/script-reference/unityengine/transform/inversetransformpoints.md), [Transform.TransformDirections](/engine/6000.0/script-reference/unityengine/transform/transformdirections.md), [Transform.TransformVectors](/engine/6000.0/script-reference/unityengine/transform/transformvectors.md).
