dynamically resize 3D model in arkit

hello , here i am facing issue with resizing 3d model with obj file in arkit so please give me some solution.

Thanks in advance .

Replies

You can resize objects by adjusting the scale based on user input via a UIPinchGestureRecognizer.


The exact way that you impliment the usage of that pinch will differ depending on whether you are using RealityKit, SceneKit, or Metal for rendering.


For RealityKit, you could use the pinch gesture's scale with the scale(relativeTo:) method on a ModelEntity's transform component.

For SceneKit, you could use the pinch gesture's scale with the scale property of the SCNNode.


It is a good idea to limit the amount that an object can be scaled up/down so that the user never loses visibility of the object when they are scaling it.

Hello,

For RealityKit, is-it possible when using the scale(relativeTo:) method, to change the pivot point from center to the bottom base!

For example I want to scale up a cube from it's bottom base upward, and not scale it from it's center point.

Similar to SCNNode.pivot proeprty in SceneKit.

you can achieve this by either giving it a parent node which exists right at the base of the cube, or using the move() command to change the transform to scaling while changing the position at the same rate