'How to adjust node as per pivot

In Scenekit

let's say I have 2 BOX , box1 with PIVOT , box2 without PIVOT

My Goal is to match both of boxes with transformation

      let plane = SCNBox(width: 12, height: 2, length: 12, chamferRadius: 0)
      plane.firstMaterial?.diffuse.contents = UIColor.red
      let planeNode = SCNNode(geometry: plane)
      planeNode.name = "Plane1"
      planeNode.pivot  = SCNMatrix4MakeTranslation(0, -0.5, 0)

Box 2

      let plane2 = SCNBox(width: 12, height: 2, length: 12, chamferRadius: 0)
      plane2.firstMaterial?.diffuse.contents = UIColor.red
      let planeNode2 = SCNNode(geometry: plane2)
      planeNode2.name = "Plane2"

Now I scale BOX1 and box2

planeNode.scale.y = 4 planeNode2.scale.y = 4

as planeNode has pivot so it will be scale from bottom , but Plane2 will be scale from center

How can I calculate position of plane2 that it will match the plane1



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source