This is my code for handling pinch. This only zoom the whole model in its pivot even if we pinch in a specific region. I want to pinch zoom only in the selected area of model.How to achieve this?
Even after applying node hittest, it did'nt worked as expected. Is there any alternative solution for this?
@objc func handlePinch(_ sender: UIPinchGestureRecognizer? = nil) {
if isModelAdded{
if sender?.state == .began{
currentScale = airportModelEntity!.scale
senderScale = sender!.scale
}else{
let newScale = currentScale + Float(sender!.scale - senderScale)
let finalScale = Float(max(min(modelMaxScale as! Double, Double(newScale.x)),modelMinScale))
airportModelEntity?.scale = (finalScale > 0) ? SCNVector3Make(finalScale, finalScale, finalScale) : SCNVector3Make(0, 0, 0)
currentModelScale = airportModelEntity?.scale
}
}
}