Thin instance picking with action manager

Hi team,

I am getting thinInstanceIndex in scene.onPointerDown event along mesh name with:

scene.onPointerDown = function (evt, pickResult) {
        console.log(pickResult.thinInstanceIndex)
        console.log(pickResult.pickedMesh.id)
};

is it possible, instead scene.onPointerDown could I get this information with action manager to know which thinInstanceIndex was clicked?

sphere.actionManager = new BABYLON.ActionManager(scene);
sphere.actionManager.registerAction(
    new BABYLON.ExecuteCodeAction(BABYLON.ActionManager.OnPickTrigger,
        function (event) {
            
        })
);

Thanks

That sounds like a pretty cool idea :slight_smile:

@Evgeni_Popov will have a closer look next year… so on Monday :wink:

1 Like

Thank you @sebavan , you guys are awesome.

I have one another question on this. If I create an instance buffer like:

obj.thinInstanceSetBuffer("matrix", bufferMatrices, 16, true);
obj.thinInstanceSetBuffer("someOtherBuffer", otherBufferMatrices, 4, true); 

can we also get someOther buffer values in otherBufferMatrices?

scene.onPointerDown = function (evt, pickResult) {
        console.log(pickResult.someOtherBuffer)
};

nope, for this you ll need to probably use the index and manually get the correct value back.

1 Like

PR:

You will get in event.additionalData the PickingInfo structure you get with the regular scene pick method:

3 Likes

@Evgeni_Popov and @sebavan Thank you so much for all, and I wish you all a great 2021

I wanted to ask about PR’s , I am using BabylonJS in typescript with npm babylonjs@preview , when you publish a PR does it get pushed to the package or I have to clone master branch from GitHub for latest updates? in case PR’s are delayed to be published in npm, can I please get instructions for how to setup latest branch for typescript?

Thanks

@Dshah_H, this guide may help: Start Contributing to Babylon.js | Babylon.js Documentation

2 Likes