|
|
|
@ -22,6 +22,7 @@ class MyARView : ARView{
|
|
|
|
|
convenience init() {
|
|
|
|
|
self.init(frame: UIScreen.main.bounds)
|
|
|
|
|
addBoardToTheFloor()
|
|
|
|
|
addMeepleToBoard()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -52,9 +53,32 @@ class MyARView : ARView{
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func addMeepleToBoard(){
|
|
|
|
|
func addMeepleToBoard(){ //boardAnchor : AnchorEntity
|
|
|
|
|
let configuration = ARWorldTrackingConfiguration()
|
|
|
|
|
session.run(configuration)
|
|
|
|
|
|
|
|
|
|
let objectsName = [ "rat", "cat", "dog", "wolf", "leopard", "tiger", "lion", "elephant"]
|
|
|
|
|
var iterator : Int = 0
|
|
|
|
|
|
|
|
|
|
let anchor = AnchorEntity(.plane(.horizontal, classification: .any, minimumBounds: SIMD2<Float>(0.3, 0.3))) //Une anchor par case ou une pour tout le plateau ?
|
|
|
|
|
scene.addAnchor(anchor)
|
|
|
|
|
|
|
|
|
|
/// TODO : Lier au model ?
|
|
|
|
|
for row in 0...7{
|
|
|
|
|
for col in 0...7{
|
|
|
|
|
if (col % 2 == row % 2 ){
|
|
|
|
|
let meeple = try? Entity.load(named: objectsName[iterator % 7]) //miteux
|
|
|
|
|
iterator += 1
|
|
|
|
|
if let meeple {
|
|
|
|
|
|
|
|
|
|
meeple.position.x += 0.1145 * Float(row)
|
|
|
|
|
meeple.position.y += 0.1145 * Float(col)
|
|
|
|
|
|
|
|
|
|
anchor.addChild(meeple)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// func createAnchor(){
|
|
|
|
|