I created a plane with unlit material with png texture, and I want use it as an indicator to show users where to put models in the scene.
But if the grounding shadow is enabled, the plane is flickering with shadow and looks really weird. If the grounding shadow is disabled it works fine. But I do want other models have grounding shadow. So I wonder if I can disable this specific plane's grounding shadow, or if there is a way to solve the flickering?
Here's my code
let planeMesh = MeshResource.generatePlane(width: 0.8, depth: 0.8)
let planeAnchor = AnchorEntity(plane: .horizontal)
var material = UnlitMaterial(color: .white)
material.color.texture = try! .init(.load(named:"indicator"))
indicatorEntity = ModelEntity(mesh: planeMesh, materials: [material])
planeAnchor.addChild(indicatorEntity)
arView.scene.addAnchor(planeAnchor)
func session(_ session: ARSession, didUpdate frame: ARFrame) {
guard let result = self.arView.raycast(from: arView.center, allowing: .estimatedPlane, alignment: .horizontal).first else {
return
}
indicatorEntity.setTransformMatrix(result.worldTransform, relativeTo: nil)
}