Thank you.
This is what I implemented as per my requirements.
If anybody has any suggestions. feel free to add.
if (model.editWindowAdded) {
guard worldTracking.state == .running else { return }
let deviceAnchor = worldTracking.queryDeviceAnchor(atTimestamp: CACurrentMediaTime())
guard let deviceAnchor, deviceAnchor.isTracked else { return }
let theattachment = attachments.entity(for: "sample")!
entityDummy.addChild(theattachment)
entityDummy.setTransformMatrix(model.handAnchorLeft.originFromAnchorTransform, relativeTo: nil)
theattachment.position = [0, 0.1, 0]
entityDummy.look(at: SIMD3<Float>(deviceAnchor.originFromAnchorTransform.columns.3.x,deviceAnchor.originFromAnchorTransform.columns.3.y,deviceAnchor.originFromAnchorTransform.columns.3.z), from: entityDummy.position, relativeTo: nil)
let theyasix = entityDummy.transformMatrix(relativeTo: nil).gravityAligned.rotation
entityDummy.setOrientation(theyasix, relativeTo: nil)
let newOrientation1: Rotation3D
let orientation2 = Rotation3D(entityDummy.orientation(relativeTo: nil))
newOrientation1 = orientation2.rotated(by: .init(angle: .degrees(180), axis: .y))
entityDummy.setOrientation(.init(newOrientation1), relativeTo: nil)
}