How to get Entity position after transalation with Gestures

Hello, I am trying to get the transform matrix of an Entity after a translation like this:

uiView.scene.findEntity(named: "Model_Name")?.transform.matrix

I move the 3D model around the scene and i call this method again and the matrix is still the same. So i can't get the latest transform matrix of my 3D model.

This is the way I create an Entity

var anchorEntity = AnchorEntity()

anchorEntity = AnchorEntity(.plane(.any,
                            classification: .any,
                            minimumBounds: [0.1, 0.1]))

anchorEntity.addChild(MyEntity, preservingWorldTransform: true)
             
uiView.scene.addAnchor(anchorEntity)

I can get the latest position (X,Y,Z) of the Entity via EntityTranslationGestureRecognizer

 guard let translationGesture = recognizer as? EntityTranslationGestureRecognizer else { return }
    let position = translationGesture.location(in: translationGesture.entity)

Is there any way to get the latest transform matrix of an Entity because I want to create an ArAnchor in the latest position of my 3D model.

I'm not able to reproduce the behavior you have described. When I move an Entity via an EntityTranslationGestureRecognizer, the movement is correctly reflected in the transform of that Entity.

Maybe you are checking the transform of the wrong entity?

Note that entity.transform.matrix will give you the matrix relative to its parent Entity, so maybe you are moving the parent (and it's child moves too), and then you are checking the matrix of the child (which would always be the same relative to the parent in this case). If that is what is happening, try logging entity.transformMatrix(relativeTo: nil) which will give you the matrix in world space. If that value changes, then it is likely you have been checking the transform of a child of the Entity that you actually moved.

How to get Entity position after transalation with Gestures
 
 
Q