1
votes

I want a cube to be scaled only over the positive z-axis. Now when I scale it, it's always scaled around its center. So for this I will have to change the anchor point of the object.

I know in SceneKit there was a pivot property you could use.

Is there a way to do this in RealityKit too?

2

2 Answers

1
votes

It's a pity, but at the moment, when working with a RealityKit framework you have no possibility to operate with a model's pivot point. Hence, the only way now is to set pivot point in 3D application.

1
votes

I found a fairly easy way to replicate the pivot functionality from SceneKit, in RealityKit.

All you need to do is wrap your ModelEntity within another outer "parent" Entity and offset the inner ModelEntity by the desired pivot value (SIMD3<Float>).

Once you've done that, you can position or rotate the outer "parent" entity and the inner entity will behave in essentially the same way as a SceneKit SCNNode with a pivot value applied.