Friday, May 16, 2025
HomeiOS Developmentios - Airplane entity's grounding shadow flicking in RealityKit

ios – Airplane entity’s grounding shadow flicking in RealityKit

[ad_1]

I created a airplane with unlit materials with png texture, and I need use it as an indicator to point out customers the place to place fashions within the scene.
But when the grounding shadow is enabled, the airplane is flickering with shadow and appears actually bizarre.

If the grounding shadow is disabled it really works effective. However I do need different fashions have grounding shadow. So I’m wondering if I can disable this particular airplane’s grounding shadow, or if there’s a option to resolve the flickering?

This is my code

let planeMesh = MeshResource.generatePlane(width: 0.8, depth: 0.8)
let planeAnchor = AnchorEntity(airplane: .horizontal)
var materials = UnlitMaterial(colour: .white)
materials.colour.texture = strive! .init(.load(named:"indicator"))
indicatorEntity = ModelEntity(mesh: planeMesh, supplies: [material])
planeAnchor.addChild(indicatorEntity)
arView.scene.addAnchor(planeAnchor)
    func session(_ session: ARSession, didUpdate body: ARFrame) {
        guard let end result = self.arView.raycast(from: arView.heart, permitting: .estimatedPlane, alignment: .horizontal).first else {
            return
        }
        indicatorEntity.setTransformMatrix(end result.worldTransform, relativeTo: nil)
    }

[ad_2]

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments