I'm detecting collision between two entities. I'm trying to get the collision position by using .position. The collision code is below
var body: some View {
RealityView() {content in
content.add(fingerModel.setupContentEntity())
mainSphere = fingerModel.addSphere()
//collision detection
subscription = content.subscribe(to: CollisionEvents.Began.self, on: mainSphere) {
collisionEvent in
print("Collision started between \(collisionEvent.entityA.name) and \(collisionEvent.entityB.name)")
if let componentB = collisionEvent.entityB.components[FingerCollideComponent.self] {
print("Found finger collision component on \(collisionEvent.entityB.name) with tag \(componentB.tag)")
if componentB.tag == CollisionTag.postIt {
onPostItCollide(postItEntity : componentB.pivotEntity)
}
if componentB.tag == CollisionTag.wall {
print("Collision position is \(collisionEvent.position)")
onWallCollide(contactPoint : collisionEvent.position)
}
}
}
}
.gesture(sphereDragGesture())
}
The collision detection is working fine. However, the collision.position is showing that it's coming out to (0,0,0). Is this a problem anyone else has?