# UpdateInstanceTransform

> Updates the transformation of a ray tracing instance.

## Definition

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

## UpdateInstanceTransform(Renderer)

Updates the transformation of a ray tracing instance.

```csharp
public void UpdateInstanceTransform(Renderer renderer)
```

### Parameters

**** (\[Renderer]\(/engine/6000.7/script-reference/unityengine/renderer)): The Renderer associated with a ray tracing instance.

### Remarks

For a ray tracing instance associated with a Renderer component, Unity retrieves the transformation from the Transform component.

## UpdateInstanceTransform(int, Matrix4x4)

Updates the transformation of a ray tracing instance.

```csharp
public void UpdateInstanceTransform(int handle, Matrix4x4 matrix)
```

### Parameters

**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The handle associated with a AABB or Mesh ray tracing instance.**** (\[Matrix4x4]\(/engine/6000.7/script-reference/unityengine/matrix4x4)): The new transformation matrix of the ray tracing instance.

### Remarks

Pass along a new transformation matrix and the handle [RayTracingAccelerationStructure.AddInstance](/engine/6000.7/script-reference/unityengine/rendering/raytracingaccelerationstructure/addinstance.md) returns in order to transform a ray tracing instance associated with a axis-aligned bounding box (AABB) [GraphicsBuffer](/engine/6000.7/script-reference/unityengine/graphicsbuffer.md) or a [Mesh](/engine/6000.7/script-reference/unityengine/mesh.md).

Access the transformation matrix in shader code using `WorldToObject()` or `ObjectToWorld()` HLSL functions.

To trigger an acceleration structure build on the GPU, call [RayTracingAccelerationStructure.Build](/engine/6000.7/script-reference/unityengine/rendering/raytracingaccelerationstructure/build.md) or [CommandBuffer.BuildRayTracingAccelerationStructure](/engine/6000.7/script-reference/unityengine/rendering/commandbuffer/buildraytracingaccelerationstructure.md).

Additional Resources: [RayTracingAccelerationStructure.AddInstance](/engine/6000.7/script-reference/unityengine/rendering/raytracingaccelerationstructure/addinstance.md), [RayTracingAccelerationStructure.RemoveInstance](/engine/6000.7/script-reference/unityengine/rendering/raytracingaccelerationstructure/removeinstance.md).
