Markerless AR .gltf object placement (8.8 KB) Hi,
I am trying to import .gltf object in markerless AR, the example I refered has .babylon object and I tried replacing it with .gltf and removed all .babylon object references but the object placement is not working. Any suggestions?

Attached the 3d gltf file and also the index file.

Could you share the repro in the playground ? @RaananW will be able to have a look on Monday

There is a skull object that I am importing from github and the skull object is not getting placed when performing hit test.

1 Like

Importing a mesh directly you will need to reference the mesh you want to place. Import returns an object full of other objects - meshes, skeletons, etc’:

MarkerLess AR | Babylon.js Playground (

Is it possible to create mesh instance rather than using clone() in AR

Everything is possible, of course. just create an instance instead of cloning.

VR/AR has no magic parameters for babylon. It is still the same camera style, the same transformations, the same effects. There are little to no limitations on the babylon side of things. do what you would have done as if you are creating a regular scene for desktop/mobile.

1 Like

@RaananW need help in mesh rotation. Tried to change the rotation of cloned mesh, I guess I made some mistake.

//!!! Creating an Clone !!!
if (anchors) {
console.log(‘anchors attached’);
anchors.onAnchorAddedObservable.add(anchor => {
console.log(‘attaching’, anchor);
b.isVisible = true;
var clonedmesh = b.clone(“meshmodel”);

            clonedmesh.rotationQuaternion =null;
            clonedmesh.rotation = new BABYLON.Vector3(0, Math.PI/2, 0);

            anchor.attachedNode = clonedmesh;
            b.isVisible =false;
        anchors.onAnchorRemovedObservable.add(anchor => {
            console.log('disposing', anchor);
            if (anchor) {
                anchor.attachedNode.isVisible = false;

We will need a bit more than that :slight_smile:

I would first suggest to stick to quaternions, if they are already there, and will be happy to see an example (maybe without the XR components, as this is not directly related to XR)

Sharing the playground for reference. I need to change the skull model y-axis rotation (hit test).

This is an exact copy of the demo from the documentation, with a different model. I don’t quite see where you are trying to rotate it?

I am not sure what exactly you want to achieve, but changing the rotation of the model is the same as changing the rotation of any mesh. you can use the .rotate function, you can multiply the existing quaternion with another quaternion, you can set the quaternion to be what you want it to be.

Hit test provides you with basic rotation. If you want a specific one, you will need to define what exactly you want it to be, and set it.

Changing the Y-Axis will not work as you expect it to be. The object might already be rotated on the y axis.

1 Like

Yes you are right!, I have changed only the model, I tried to rotate the cloned mesh by setting

clonedmesh.rotationQuaternion =null;
clonedmesh.rotation = new BABYLON.Vector3(0, Math.PI/2, 0);

but it is not working so I removed it. also i tried performing rotation onto the model before cloning. Like

model.rotationQuaternion =null;
model.rotation = new BABYLON.Vector3(0, Math.PI/2, 0);

It was also not working.
I am trying to achieve something like this Body Exploration using Markerless Augmented Reality - Unity + Kudan - YouTube

Try first without AR - understand how rotation works in babylonjs, experiment with the .rotate function and with quaternions. Maybe this would help - Centered on Created Origin | Babylon.js Documentation

Once you get the model to rotate as you wish, use it in AR as well. it will work the same.