There's a very similar question on StackOverflow - https://stackoverflow.com/q/44556771/4002530 with no answers. This does seem like a bug doesn't it.
swift
import GameplayKit
let tree = GKOctree(boundingBox: GKBox(
boxMin: vector_float3(x: -10, y: -10, z: -10),
boxMax: vector_float3(x: 10, y: 10, z: 10)
), minimumCellSize: 0.1)
tree.add(NSObject(), at: vector_float3(x: 0, y: 0, z: 0))
tree.elements(at: vector_float3(x: 0, y: 0, z: 0)).count // 1, fine
tree.elements(in: GKBox(
boxMin: vector_float3(x: -1, y: -1, z: -1),
boxMax: vector_float3(x: 1, y: 1, z: 1)
)).count // 0, ??
tree.elements(in: GKBox(
boxMin: vector_float3(x: 1, y: 1, z: 1),
boxMax: vector_float3(x: -1, y: -1, z: -1)
)).count // 0, well I tried
// The original defining bounding box
tree.elements(in: GKBox(
boxMin: vector_float3(x: -10, y: -10, z: -10),
boxMax: vector_float3(x: 10, y: 10, z: 10)
)).count // 0, ***
Post
Replies
Boosts
Views
Activity
One thing to chekc is that your diffable items are Reference types (class), and not Value types (structs).