|
|
@ -13,6 +13,7 @@ import UIKit
|
|
|
|
|
|
|
|
|
|
|
|
class ArKitView : ARView {
|
|
|
|
class ArKitView : ARView {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var vmArkit:VMArkit?
|
|
|
|
|
|
|
|
|
|
|
|
required init(frame frameRect: CGRect) {
|
|
|
|
required init(frame frameRect: CGRect) {
|
|
|
|
super.init(frame: frameRect)
|
|
|
|
super.init(frame: frameRect)
|
|
|
@ -22,8 +23,9 @@ class ArKitView : ARView {
|
|
|
|
fatalError("init(coder:) not implemented")
|
|
|
|
fatalError("init(coder:) not implemented")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
convenience init() {
|
|
|
|
convenience init(_ vmArkit:VMArkit){
|
|
|
|
self.init(frame: UIScreen.main.bounds)
|
|
|
|
self.init(frame: UIScreen.main.bounds)
|
|
|
|
|
|
|
|
self.vmArkit = vmArkit
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func applyConfiguration() {
|
|
|
|
func applyConfiguration() {
|
|
|
@ -57,8 +59,22 @@ class ArKitView : ARView {
|
|
|
|
switch translationGesture.state {
|
|
|
|
switch translationGesture.state {
|
|
|
|
case .began:
|
|
|
|
case .began:
|
|
|
|
self.initialTransform = entity.transform
|
|
|
|
self.initialTransform = entity.transform
|
|
|
|
|
|
|
|
|
|
|
|
case .ended:
|
|
|
|
case .ended:
|
|
|
|
entity.move(to: initialTransform, relativeTo: entity.parent, duration: 1)
|
|
|
|
entity.move(to: initialTransform, relativeTo: entity.parent, duration: 1)
|
|
|
|
|
|
|
|
let pos = entity.position
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ( pos.x > )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (localisation.x > 450 || localisation.x < -450 || localisation.y < -350 || localisation.y > 350){
|
|
|
|
|
|
|
|
print("Hors limite !")
|
|
|
|
|
|
|
|
self.position = returnPositionByCellPos(cellX:Int(self.cellPosition.x),cellY:Int(self.cellPosition.y))
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
break
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|