Reputation: 101
When adding a model directly to a scene anchor from a usdz file, there are no grounding shadows appearing under the model. These appear if you import the model into RealityComposer and add the RealityComposer scene. But can you enable grounding shadows without using RC?
I have tried adding a DirectionalLight to the scene, but this is not casting any shadows. I have also tried changing the RenderingOptions on the ARView.
//no shadows
penguin = try? Entity.loadModel(named: "penguin", in: nil)
penguinAnchor.addChild(penguin!)
//shadows
penguinScene = try! PenguinRC.loadPenguinScene()
arView.scene.addAnchor(penguinScene)
Upvotes: 2
Views: 1173
Reputation: 578
I made some progress with this issue.
Casting shadows from loaded USDZs seems to rely on the Entity (or better) ModelEntity to be added to an AnchorEntity with via a plane initializer rather than a simple AnchorEntity() like so:
let penguinAnchor = AnchorEntity(plane: .horizontal, classification: .any, minimumBounds: [0.1, 0.1])
Not 100% sure if this is really the part which resolved my issue though.
Upvotes: 3