Class

SpotLight

An entity that illuminates virtual content in a cone-shaped volume.

Declaration

class SpotLight : Entity

Overview

During an AR session, RealityKit automatically lights your virtual objects to match real-world lighting. You can also explicitly add virtual lights that act upon your virtual content. This is typically most useful outside of an AR session (with the view’s cameraMode property set to ARView.CameraMode.nonAR).

Topics

Creating a Spotlight

init()

Creates a spotlight entity.

func clone(recursive: Bool) -> Self

Duplicates a spotlight entity to create a new spotlight entity.

Identifying a Spotlight

var id: ObjectIdentifier

The stable identity of the entity associated with self.

var id: UInt64

The stable identity of the spotlight.

typealias SpotLight.ID

A type of unique identifier used for a spotlight.

Configuring the Spot Light

var light: SpotLightComponent

A spotlight component for the entity.

struct SpotLightComponent

A component that defines a spotlight source.

var shadow: SpotLightComponent.Shadow?

The shadow cast by a spot light.

protocol HasSpotLight

An interface that defines a spot light source component.

Loading a Stored Entity

Stored Entities

Manage entities stored as assets on disk.

Positioning Entities in Space

Finding the Nearest Anchor

Calculating the Collision Shape

Describing the Light

See Also

Cameras and Lighting

class PerspectiveCamera

A virtual camera that establishes the rendering perspective.

class PointLight

An entity that produces an omnidirectional light for virtual objects.

class DirectionalLight

An entity that casts a virtual light in a particular direction.