# Swizzle

> Transform a 3D vector into a 3D vector using the selected transform plane. If PhysicsWorld.TransformPlane.Custom is used, PhysicsWorld.TransformPlane.XY will be used instead which may not provide the correct results.

## Definition

* **Type:** Method
* **Namespace:** [Unity.U2D.Physics](/engine/6000.5/script-reference/unity/u2d/physics.md)
* **Assembly:** UnityEngine.PhysicsCore2DModule

## Swizzle(Vector3, TransformPlane)

Transform a 3D vector into a 3D vector using the selected transform plane. If [PhysicsWorld.TransformPlane.Custom](/engine/6000.5/script-reference/unity/u2d/physics/physicsworld/transformplane/custom.md) is used, [PhysicsWorld.TransformPlane.XY](/engine/6000.5/script-reference/unity/u2d/physics/physicsworld/transformplane/xy.md) will be used instead which may not provide the correct results.

```csharp
public static Vector3 Swizzle(Vector3 position, PhysicsWorld.TransformPlane transformPlane = TransformPlane.XY)
```

### Parameters

**** (\[Vector3]\(/engine/6000.5/script-reference/unityengine/vector3)): The 3D vector to transform.**** (\[TransformPlane]\(/engine/6000.5/script-reference/unity/u2d/physics/physicsworld/transformplane)): The transform plane to use.

### Returns

| Type                                                              | Description             |
| ----------------------------------------------------------------- | ----------------------- |
| [Vector3](/engine/6000.5/script-reference/unityengine/vector3.md) | The transformed vector. |

## Swizzle(Vector4, TransformPlane)

Transform a 3D position (with perspective divide) into a 3D position using the selected transform plane. If [PhysicsWorld.TransformPlane.Custom](/engine/6000.5/script-reference/unity/u2d/physics/physicsworld/transformplane/custom.md) is used, [PhysicsWorld.TransformPlane.XY](/engine/6000.5/script-reference/unity/u2d/physics/physicsworld/transformplane/xy.md) will be used instead which may not provide the correct results.

```csharp
public static Vector4 Swizzle(Vector4 position, PhysicsWorld.TransformPlane transformPlane = TransformPlane.XY)
```

### Parameters

**** (\[Vector4]\(/engine/6000.5/script-reference/unityengine/vector4)): The 3D position to transform.**** (\[TransformPlane]\(/engine/6000.5/script-reference/unity/u2d/physics/physicsworld/transformplane)): The transform plane to use.

### Returns

| Type                                                              | Description               |
| ----------------------------------------------------------------- | ------------------------- |
| [Vector4](/engine/6000.5/script-reference/unityengine/vector4.md) | The transformed position. |

## Swizzle(Matrix4x4, TransformPlane)

Transform a Matrix position (with perspective divide) into a Matrix position using the selected transform plane. If [PhysicsWorld.TransformPlane.Custom](/engine/6000.5/script-reference/unity/u2d/physics/physicsworld/transformplane/custom.md) is used, [PhysicsWorld.TransformPlane.XY](/engine/6000.5/script-reference/unity/u2d/physics/physicsworld/transformplane/xy.md) will be used instead which may not provide the correct results.

```csharp
public static Matrix4x4 Swizzle(Matrix4x4 matrix, PhysicsWorld.TransformPlane transformPlane = TransformPlane.XY)
```

### Parameters

**** (\[Matrix4x4]\(/engine/6000.5/script-reference/unityengine/matrix4x4)): The Matrix position to transform.**** (\[TransformPlane]\(/engine/6000.5/script-reference/unity/u2d/physics/physicsworld/transformplane)): The transform plane to use.

### Returns

| Type                                                                  | Description             |
| --------------------------------------------------------------------- | ----------------------- |
| [Matrix4x4](/engine/6000.5/script-reference/unityengine/matrix4x4.md) | The transformed matrix. |
