<!--
{
  "availability" : [
    "iOS: 18.0.0 -",
    "iPadOS: 18.0.0 -",
    "macCatalyst: 18.0.0 -",
    "macOS: 15.0.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "RealityKit",
  "identifier" : "/documentation/RealityKit/DynamicLightShadowComponent",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:17RealityFoundation27DynamicLightShadowComponentV"
  },
  "title" : "DynamicLightShadowComponent"
}
-->

# DynamicLightShadowComponent

A component that controls an entity’s shadow from dynamic (virtual) lights.

```
struct DynamicLightShadowComponent
```

## Overview

Use `DynamicLightShadowComponent` to control whether an entity casts shadows from
dynamic (virtual) lights.
Dynamic lights cast shadows on other virtual objects, but not on physical objects.
You can add a dynamic light shadow component to any entity
that has a [`ModelComponent`](/documentation/RealityKit/ModelComponent) in its component set by adding a dynamic light shadow
component to the entity’s [`components`](/documentation/RealityKit/Entity/components) property.

```swift
if let model = try? await ModelEntity(named: "tv_retro") {
    let shadowComponent = DynamicLightShadowComponent(castsShadow: false)
    model.components.set(shadowComponent)
}
```

You need to add the dynamic lights shadow component to each entity you want to
apply the effect to because the dynamic light shadow component doesn’t apply to
hierarchies.

> Note: By default, without a dynamic light shadow component, entities cast
> shadows from dynamic lights.

## Topics

### Initializers

[`init(castsShadow: Bool)`](/documentation/RealityKit/DynamicLightShadowComponent/init(castsShadow:))

Creates a dynamic light shadow component.

### Instance Properties

[`var castsShadow: Bool`](/documentation/RealityKit/DynamicLightShadowComponent/castsShadow)

A Boolean value that indicates whether an entity casts a shadow.

## Relationships

### Conforms To

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

---

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)