Skip to content

Commit 9823ed0

Browse files
committed
修复了一些bug
1 parent 2f93d25 commit 9823ed0

File tree

4 files changed

+3
-9
lines changed

4 files changed

+3
-9
lines changed

ARDoor/ARDoor/ARViewController.swift

-7
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ extension ARViewController {
7676
func addPortal(with transform: matrix_float4x4) {
7777
guard let portalScene = SCNScene(named: "Model.scnassets/tjgc.scn") else {return}
7878
let portalNode = portalScene.rootNode.childNode(withName: "tjgc", recursively: false)!
79-
// hit test
8079
let newVector3 = SCNVector3.init(withTransform: transform)
8180
portalNode.position = SCNVector3.init(newVector3.x, newVector3.y, newVector3.z-1)
8281
sceneView.scene.rootNode.addChildNode(portalNode)
@@ -127,12 +126,6 @@ extension ARViewController: ARSCNViewDelegate {
127126
// Judge the plane if it is horizontal plane
128127
guard anchor is ARPlaneAnchor else {return}
129128

130-
// 不是第一次检测到,直接返回
131-
// Not the first time detected, so return directlly
132-
if self.planeAnchor != nil {
133-
return
134-
}
135-
136129
self.planeAnchor = anchor as? ARPlaneAnchor
137130

138131
// 启用放置按钮, 显示可放置标签

ARDoor/ARDoor/Base.lproj/Main.storyboard

+1
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@
9797
</viewController>
9898
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
9999
</objects>
100+
<point key="canvasLocation" x="127" y="22"/>
100101
</scene>
101102
</scenes>
102103
</document>
0 Bytes
Binary file not shown.

ARDoor/ARDoor/SCNVector3+Extension.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ extension SCNVector3 {
2525

2626
init (withNode node: SCNNode) {
2727
let transform = node.transform
28-
let oritation = SCNVector3(-transform.m31, -transform.m32, -transform.m33)
28+
let orientation = SCNVector3(-transform.m31, -transform.m32, -transform.m33)
2929
let location = SCNVector3(transform.m41, transform.m42, transform.m43)
30-
let currentPosition = oritation + location
30+
let currentPosition = orientation + location
3131

3232
self = currentPosition
3333
}

0 commit comments

Comments
 (0)