Last active
December 8, 2021 22:17
-
-
Save eospi/413c6b76f5683ac9831bf0e6c0e4f7ec to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
guard let query = arView.makeRaycastQuery(from: arView.center, allowing: .existingPlaneInfinite, alignment: .horizontal) else { return } | |
guard let raycastResult = arView.session.raycast(query).first else { return } | |
// set a transform to an existing entity | |
let transform = Transform(matrix: raycastResult.worldTransform) | |
entity.transform = transform | |
// or anchor an entity to an ARRaycastResult | |
let anchor = AnchorEntity(raycastResult: raycastResult) | |
anchor.addChild(entity) | |
self.arView.addAnchor(anchor) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment