Fetch the properties

I have implemented a tube using an array, While click on the tube I need to fetch the ID/ any other property related to the tube,
The array is
let a = [ 0 : {
id: 1,
name:‘ABC 114’,
width: 4,
coordinates: [
0 : Vector3 {_isDirty: true, _x: 0.0519074111250073, _y: -0.6667282521477385, _z: -0.05896724359515171}
1 : Vector3 {_isDirty: true, _x: -0.2588318128009773, _y: -0.5306716879469504, _z: -0.3573180117024619}
2 : Vector3 {_isDirty: true, _x: 0.06530535196890641, _y: -0.2442954939346944, _z: 0.18382948625578754
]
},
1 : {
id: 2,
name:‘ABC 116’,
width: 4,
coordinates: [
0 : Vector3 {_isDirty: true, _x: -0.2258550538420736, _y: -0.5285717204576299, _z: -0.3627803547528552}
1 : Vector3 {_isDirty: true, _x: -0.2197264206880556, _y: -0.5326348587248702, _z: -0.36336460189180175}
2 : Vector3 {_isDirty: true, _x: -0.0823398767426744, _y: -0.5568058251560397, _z: -0.2124232597249672}
]
},
2 : {
id: 3,
name:‘ABC 118’,
width: 4,
coordinates: [
0 : Vector3 {_isDirty: true, _x: -0.0737934306862209, _y: -0.5543278177147632, _z: -0.21576680941919416}
1 : Vector3 {_isDirty: true, _x: -0.07809722497602412, _y: -0.5549957349048769, _z: -0.21538374822281778}
2 : Vector3 {_isDirty: true, _x: -0.018563166062313785, _y: -0.6337773322637466, _z: -0.0024558179126837887}
]
}
]
The click is implemented using

 <tube
        name="tube"
        path={a[i]coordinates}
        key={i}
        radius={a[i].width}
        updatable={true}
        arc={0}
        tessellation={10}
        cap={3}
        onCreated={handlePointerOver}

const handlePointerOver = (e) => {
e.actionManager = new ActionManager(e.getScene());
e.actionManager.registerAction(
new ExecuteCodeAction(
ActionManager.OnPickTrigger, function (ev) {
const target = ev.additionalData.pickedPoint; // here the picked point is return, where I need to fetch the corresponding ID of the data where that tube is respresented
}
)
);
};

It would be much more easier to help you if you could provide some PG example of what you are trying to achieve and describe more exactly what you actually need.

Seems like it is using babylon react as well so let me add @brianzinn the daddy of this part :slight_smile:

Can’t you get the mesh from the “e”? That should be in the OnPickTrigger callback via closure.

2 Likes