<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "RealityKit",
  "identifier" : "/documentation/RealityKit/HasTransform",
  "metadataVersion" : "0.1.0",
  "role" : "Protocol",
  "symbol" : {
    "kind" : "Protocol",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:17RealityFoundation12HasTransformP"
  },
  "title" : "HasTransform"
}
-->

# HasTransform

An interface that enables manipulating the scale, rotation, and translation
of an entity.

```
@MainActor @preconcurrency protocol HasTransform : Entity
```

## Overview

All entities automatically adopt this protocol because the [`Entity`](/documentation/RealityKit/Entity) base
class does. This adoption gives all entities a [`Transform`](/documentation/RealityKit/Transform) component, and
a collection of methods for manipulating the component, that you use to
position the entity in space.

## Topics

### Accessing the component

[`var transform: Transform`](/documentation/RealityKit/HasTransform/transform)

The transform of an entity relative to its parent.

### Scaling an entity

[`var scale: SIMD3<Float>`](/documentation/RealityKit/HasTransform/scale)

The scale of the entity relative to its parent.

[`func scale(relativeTo: Entity?) -> SIMD3<Float>`](/documentation/RealityKit/HasTransform/scale(relativeTo:))

Gets the scale of an entity relative to the given entity.

[`func setScale(SIMD3<Float>, relativeTo: Entity?)`](/documentation/RealityKit/HasTransform/setScale(_:relativeTo:))

Sets the scale factor of the entity relative to the given reference
entity.

### Rotating an entity

[`var orientation: simd_quatf`](/documentation/RealityKit/HasTransform/orientation)

The rotation of the entity relative to its parent.

[`func orientation(relativeTo: Entity?) -> simd_quatf`](/documentation/RealityKit/HasTransform/orientation(relativeTo:))

Gets the orientation of an entity relative to the given entity.

[`func setOrientation(simd_quatf, relativeTo: Entity?)`](/documentation/RealityKit/HasTransform/setOrientation(_:relativeTo:))

Sets the orientation of the entity relative to the given reference
entity.

### Positioning an entity

[`var position: SIMD3<Float>`](/documentation/RealityKit/HasTransform/position)

The position of the entity relative to its parent.

[`func position(relativeTo: Entity?) -> SIMD3<Float>`](/documentation/RealityKit/HasTransform/position(relativeTo:))

Gets the position of an entity relative to the given entity.

[`func setPosition(SIMD3<Float>, relativeTo: Entity?)`](/documentation/RealityKit/HasTransform/setPosition(_:relativeTo:))

Sets the position of the entity relative to the given reference entity.

### Using a matrix

[Transforming entities between RealityKit coordinate spaces](/documentation/RealityKit/transforming-entities-between-realitykit-coordinate-spaces)

Move an entity between a volumetric window and an immersive space using coordinate space transformations.

[`func transformMatrix(relativeTo: Entity?) -> float4x4`](/documentation/RealityKit/HasTransform/transformMatrix(relativeTo:))

Gets the 4 x 4 transform matrix of an entity relative to the given
entity.

### Moving an entity

[`func move(to: Transform, relativeTo: Entity?)`](/documentation/RealityKit/HasTransform/move(to:relativeTo:)-6lohd)

Moves an entity instantly to a new location given by a transform.

[`func move(to: float4x4, relativeTo: Entity?)`](/documentation/RealityKit/HasTransform/move(to:relativeTo:)-6jul8)

Moves an entity instantly to a new location given by a 4x4 matrix.

[`func look(at: SIMD3<Float>, from: SIMD3<Float>, upVector: SIMD3<Float>, relativeTo: Entity?)`](/documentation/RealityKit/HasTransform/look(at:from:upVector:relativeTo:))

Positions and orients the entity to look at a target from a given
position.

[`func look(at: SIMD3<Float>, from: SIMD3<Float>, upVector: SIMD3<Float>, relativeTo: Entity?, forward: Entity.ForwardDirection)`](/documentation/RealityKit/HasTransform/look(at:from:upVector:relativeTo:forward:))

Positions and orients the entity such that it looks at certain target from a give position.

[`func align(GeometricPin, to: GeometricPin) -> float4x4?`](/documentation/RealityKit/HasTransform/align(_:to:))

Moves and rotates the entity by a transformation from the origin pin to the target pin.

### Animating an entity

[`func move(to: Transform, relativeTo: Entity?, duration: TimeInterval, timingFunction: AnimationTimingFunction) -> AnimationPlaybackController`](/documentation/RealityKit/HasTransform/move(to:relativeTo:duration:timingFunction:)-35qp2)

Moves an entity over a period of time to a new location given by a
transform.

[`func move(to: float4x4, relativeTo: Entity?, duration: TimeInterval, timingFunction: AnimationTimingFunction) -> AnimationPlaybackController`](/documentation/RealityKit/HasTransform/move(to:relativeTo:duration:timingFunction:)-6la93)

Moves an entity over a period of time to a new location given by a 4x4
matrix.

### Converting values between coordinate spaces

[`func convert(position: SIMD3<Float>, from: Entity?) -> SIMD3<Float>`](/documentation/RealityKit/HasTransform/convert(position:from:))

Converts a position from the local space of a reference entity to the
local space of the entity on which you called this method.

[`func convert(position: SIMD3<Float>, to: Entity?) -> SIMD3<Float>`](/documentation/RealityKit/HasTransform/convert(position:to:))

Converts a position from the local space of the entity on which you
called this method to the local space of a reference entity.

[`func convert(direction: SIMD3<Float>, from: Entity?) -> SIMD3<Float>`](/documentation/RealityKit/HasTransform/convert(direction:from:))

Converts a direction vector from the local space of a reference entity
to the local space of the entity on which you called this method.

[`func convert(direction: SIMD3<Float>, to: Entity?) -> SIMD3<Float>`](/documentation/RealityKit/HasTransform/convert(direction:to:))

Converts a direction vector from the local space of the entity on which
you called this method to the local space of a reference entity.

[`func convert(normal: SIMD3<Float>, from: Entity?) -> SIMD3<Float>`](/documentation/RealityKit/HasTransform/convert(normal:from:))

Converts a normal vector from the local space of a reference entity to
the local space of the entity on which you called this method.

[`func convert(normal: SIMD3<Float>, to: Entity?) -> SIMD3<Float>`](/documentation/RealityKit/HasTransform/convert(normal:to:))

Converts a normal vector from the local space of the entity on which you
called this method to the local space of a reference entity.

[`func convert(transform: Transform, from: Entity?) -> Transform`](/documentation/RealityKit/HasTransform/convert(transform:from:))

Converts the scale, rotation, and position of a transform from the local
space of a reference entity to the local space of the entity on which
you called this method.

[`func convert(transform: Transform, to: Entity?) -> Transform`](/documentation/RealityKit/HasTransform/convert(transform:to:))

Converts the scale, rotation, and position of a transform from the local
space of the entity on which you called this method to the local space
of a reference entity.

### Getting a bounding box

[`func visualBounds(recursive: Bool, relativeTo: Entity?, excludeInactive: Bool) -> BoundingBox`](/documentation/RealityKit/HasTransform/visualBounds(recursive:relativeTo:excludeInactive:))

Computes a bounding box for the entity in the specified space,
optionally including child entities.

### Instance Methods

[`func move(to:relativeTo:)`](/documentation/RealityKit/HasTransform/move(to:relativeTo:))

Moves an entity instantly to a new location given by a transform.

[`func move(to:relativeTo:duration:timingFunction:)`](/documentation/RealityKit/HasTransform/move(to:relativeTo:duration:timingFunction:))

Moves an entity over a period of time to a new location given by a
transform.

[`func setTransformMatrix(float4x4, relativeTo: Entity?)`](/documentation/RealityKit/HasTransform/setTransformMatrix(_:relativeTo:))

Sets the transform of the entity relative to the given reference entity
using a 4x4 matrix representation.

## Relationships

### Inherited By

[`HasPointLight`](/documentation/RealityKit/HasPointLight)

[`HasBodyTracking`](/documentation/RealityKit/HasBodyTracking)

[`HasPhysicsBody`](/documentation/RealityKit/HasPhysicsBody)

[`HasCollision`](/documentation/RealityKit/HasCollision)

[`HasModel`](/documentation/RealityKit/HasModel)

[`HasSpotLight`](/documentation/RealityKit/HasSpotLight)

[`HasPhysics`](/documentation/RealityKit/HasPhysics)

[`HasDirectionalLight`](/documentation/RealityKit/HasDirectionalLight)

[`HasPerspectiveCamera`](/documentation/RealityKit/HasPerspectiveCamera)

### Conforming Types

[`PerspectiveCamera`](/documentation/RealityKit/PerspectiveCamera)

[`PointLight`](/documentation/RealityKit/PointLight)

[`ViewAttachmentEntity`](/documentation/RealityKit/ViewAttachmentEntity)

[`AnchorEntity`](/documentation/RealityKit/AnchorEntity)

[`BodyTrackedEntity`](/documentation/RealityKit/BodyTrackedEntity)

[`Entity`](/documentation/RealityKit/Entity)

[`DirectionalLight`](/documentation/RealityKit/DirectionalLight)

[`TriggerVolume`](/documentation/RealityKit/TriggerVolume)

[`SpotLight`](/documentation/RealityKit/SpotLight)

[`ModelEntity`](/documentation/RealityKit/ModelEntity)

### Inherits From

[`Entity`](/documentation/RealityKit/Entity)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)