Hit test transformation matrix in augmented reality


I am building my application on top of this playground example: https://www.babylonjs-playground.com/#KVZI50#135
I want to move the 3D object on hit test location, but I don’t want to change my model’s scale value.
I have scaled down my model in the beginning to 0.5.

But, during hit test in WebXR, I suppose the below line is increasing my model size to double.
hitTest.transformationMatrix.decompose(b.scaling, b.rotationQuaternion, b.position);

So, is there any way by which I can get the translation, rotation and scale vectors from this transformation matrix and control my model as per my choice?

Below image shows my transformation matrix values:

@RaananW will definitely be able to help here :slight_smile:

I have looked deeper into the issue and after extensive testing I can say that my model is scaled to 0.5 till hit test.

But when I tap on the screen, an anchor is created using the below code:
anchors.onAnchorAddedObservable.add(anchor => {
anchor.attachedNode = b.clone(“mensch”);

Now, the cloned mesh has a scale of 1 instead of 0.5.

Are you using latest from preview.babylonjs.com ?

You don’t have to decompose the scaling. I just did it to show what’s possible. Set the first variable in the decompose function to undefined, it will start scaled as before