One Logo Pool Ball
RealityFoundation · IOS API REFERENCE

DirectionalLight

class · iOS 13.0+ · SDK 27.1

@MainActor @preconcurrency class DirectionalLight

An entity that casts a virtual light in a particular direction. 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 on iOS or macOS, where your ``RealityViewCameraContent`` ``RealityViewCameraContent/camera`` property is set to ``RealityViewCamera/virtual``. A directional light uniformly casts light along its local z-axis—specifically, along `[0, 0, -1]`. This is equivalent to creating an ``Entity``, and then adding a ``DirectionalLightComponent`` to its ``Entity/components`` set. Use the light’s ``HasTransform/look(at:from:upVector:relativeTo:)`` method to aim the light in a particular direction. You can configure the light’s color and intensity with the component properties in ``HasDirectionalLight/light``. You can also control how or if it casts a ``HasDirectionalLight/shadow``. A RealityKit scene can contain up to eight dynamic lights, which are entities that contain a ``SpotLightComponent``, ``PointLightComponent``, or a ``DirectionalLightComponent``. This limit doesn’t include light from image-based lighting. Devices that support `MTLGPUFamily.apple6` or later lift this limit, so a scene can contain many more dynamic lights.

Members (1)

init · iOS 13.0+

init

TypeScript
static init(): Promise<DirectionalLight>
Swift declaration
@MainActor @preconcurrency required init()

Creates a new entity.

Skipped declarations

No declarations were skipped in this snapshot.

All RealityFoundation types →