2 years ago

#187201

test-img

mabarif

Why does changing ModelEntity scale seem to affect position as well?

I have been playing with session(session: didUpdate frame: ARFrame) and trying to make a ModelEntity move and scale at the same time. I start the movement by calling:

model.move(to: [-1, 0, 0], relativeTo: model.anchor, duration: 1)

Then in the session(session: didUpdate frame: ARFrame) I watch the ModelEntity move. But when I also try to scale down the ModelEntity by 50%, the ModelEntity's position goes to [-27, 0, 0] (expected is [-1, 0, 0]).

let entDistanceFromAnchor = simd_distance(transform.columns.3, entity.anchor!.transform.matrix.columns.3)
entity.setScale([0.5,0.5,0.5], relativeTo: entity.anchor)

Why is changing the scale causing the position to change as well? Is there a way to change the models scale without changing the position?

augmented-reality

realitykit

ios-animations

0 Answers

Your Answer

Accepted video resources