I have a RealityKit that allows for a user to adjust its scale and translation along a plane through some gestures. It has been generated as follows:
let aPlane = MeshResource.generatePlane(width: width, depth: depth)
let model = ModelEntity(mesh: aPlane, materials: [someMaterial])
model.generateCollisionShapes(recursive: true)
arView.installGestures([.scale, .translation], for: model)
I would like to retrieve its width and depth as a user is pinching to resize it. The goal is to display the scale of the entity (e.g. 1:1, 1:2, 3.5:1).
Any idea how I can get the width and depth values as it is being resized? I can't seem to find any attributes in the Documentation.
I have also tried overriding touchesBegan and printing the boundingRadius, but it seems to print a constant value even after it has been pinched to resize.
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
let model = modelEntities[0].children.first!.components[ModelComponent] as? ModelComponent
print(model!.mesh.bounds.boundingRadius)
}