where to apply "grounding shadow" in Reality Composer Pro?

So there's a "grounding shadow" component we can add to any entity in Reality Composer Pro. In case my use case is Apple Vision Pro + Reality Kit: I'm wondering, by default I think I'd want to add this to any entity that's a ModelEntity in my scene... right?

  1. Should we just add this component once to the root transform?
  2. Or should we add it to any entity individually if it's a model entity?
  3. Or should we not add this at all? Will RealityKit do it for us?

Or does it also depend if we use a volume or a full space?

Thanks to https://developer.apple.com/forums/thread/733918

(I tested this snippet in Vision Pro lab and it worked.)

extension Entity {
    
    public func setGroundingShadow(_ castsShadow: Bool) {
        self.enumerateHierarchy { entity, stop in
            if entity is ModelEntity {
                entity.components.set(GroundingShadowComponent(castsShadow: castsShadow))
            }
        }
    }

    private func enumerateHierarchy(_ body: (Entity, UnsafeMutablePointer<Bool>) -> ()) {
        var stop = false
        
        func enumerate(_ body: (Entity, UnsafeMutablePointer<Bool>) -> ()) {
            guard !stop else {
                return
            }

            body(self, &stop)
            
            for child in children {
                guard !stop else {
                    break
                }
                child.enumerateHierarchy(body)
            }
        }
        
        enumerate(body)
    }
}

@Gong thanks for the message. But I'm still not sure when we should apply grounding shadow, and to which entities.

where to apply "grounding shadow" in Reality Composer Pro?
 
 
Q