Vixen
(Vixen)
1
is there a way to get which face of the vtkAnnotatedCubeActor has been clicked?
trying to use a CellPicker as described here results in a pickedCellId = -1
regardless of which face has been clicked?
what I am trying to do is to change the camera view when clicking on one of the faces of the cube.
is there a way to do so?
Vixen
(Vixen)
2
results in a `pickedCellId = -1
i had 2 mistakes. picking the wrong renderer and setting pickable to false.
leaving this here in case someone made the same mistake:
const axes = vtk.Rendering.Core.vtkAnnotatedCubeActor.newInstance();
// create axes
axes.setDefaultStyle({
text: '+X',
fontStyle: 'bold',
fontFamily: 'Nunito Sans',
fontColor: 'black',
fontSizeScale: (res) => res / 2,
faceColor: '#0000ff',
faceRotation: 0,
edgeThickness: 0.1,
edgeColor: 'black',
resolution: 400,
});
const cellPicker = vtk.Rendering.Core.vtkCellPicker.newInstance();
renderWindow.getInteractor().onLeftButtonRelease((v) => {
let pos = v.position;
let point = [pos.x, pos.y, 0];
// vtkAnnotatedCubeActor spawns on a new renderer
cellPicker.pick(point, fullScreenRenderer.getRenderWindow().getRenderers()[1]);
console.log(cellPicker.getCellId());
})