2

I am having a 3D model loaded using a collada file on a Scenekit project using ObjC language. I would like to achieve dynamic scaling of the 3d model i.e a SCNNode just like as AutoLayout applies to any UIControl with constraints applied on them.

I want SCNNode scaled to the factor as that of its parent SCNView's scaling factor without clipping any parts of 3D model.

If it's possible how do I achieve the same?

Ashish Kakkad
  • 23,586
  • 12
  • 103
  • 136
Nikunj
  • 69
  • 6

2 Answers2

2

There is no convenience to do that automatically. You'll have to place the camera according to its field of view and the object's dimensions.

See How to calculate the z-distance of a camera to view an image at 100% of its original scale in a 3D space

Community
  • 1
  • 1
mnuages
  • 13,049
  • 2
  • 23
  • 40
0

Maybe I missed something but I don't see why you have to manipulate a camera.

Any SCNNode has the property of .scale, why not use that?

geometryNode.scale = SCNVector3(x:xscale,y:yscale,z:zscale)