A component that controls an entity's shadow from dynamic (virtual) lights.
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`` in its component set by adding a dynamic light shadow
component to the entity's ``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.
Creates a dynamic light shadow component.
- Parameter castsShadow: A Boolean value that indicates whether an entity
with the component casts a shadow.
By default, the component makes an entity to stop casting shadows
from dynamic lights.
get · iOS 18.0+
castsShadow
TypeScript
get castsShadow(): boolean
Swift declaration
var castsShadow: Bool
A Boolean value that indicates whether an entity casts a shadow.
set · iOS 18.0+
castsShadow
TypeScript
set castsShadow(value: boolean)
Swift declaration
var castsShadow: Bool
A Boolean value that indicates whether an entity casts a shadow.