gizmoPositionAxis code:
/** @hidden */
public static _CreateArrow(scene: BABYLON.Scene, material: BABYLON.StandardMaterial, thickness: number = 1): BABYLON.TransformNode {
var arrow = new BABYLON.TransformNode("arrow", scene);
var cylinder = BABYLON.CylinderBuilder.CreateCylinder("cylinder", { diameterTop: 0, height: 0.075, diameterBottom: 0.0375 * (1 + (thickness - 1) / 4), tessellation: 96 }, scene);
var line = BABYLON.CylinderBuilder.CreateCylinder("cylinder", { diameterTop: 0.005 * thickness, height: 0.275, diameterBottom: 0.005 * thickness, tessellation: 96 }, scene);
line.material = material
cylinder.parent = arrow;
line.parent = arrow;
// Position arrow pointing in its drag axis
cylinder.material = material;
cylinder.rotation.x = Math.PI / 2;
cylinder.position.z += 0.3;
line.position.z += 0.275 / 2;
line.rotation.x = Math.PI / 2;
return arrow;
}
the arrow consists of two cylinders.The mouse when choosing arrow moving ,the ''pointerInfo.pickInfo.pickedMesh" is "cylinder "
I change the ‘line’ cylinders to the lineMesh, just like that:
the code:
/** @hidden */
public static _CreateArrow(scene: BABYLON.Scene, material: BABYLON.StandardMaterial, thickness: number = 1): BABYLON.TransformNode {
var arrow = new BABYLON.TransformNode("arrow", scene);
var cylinder = BABYLON.CylinderBuilder.CreateCylinder("cylinder", { diameterTop: 0, height: 0.075, diameterBottom: 0.0375 * (1 + (thickness - 1) / 4), tessellation: 96 }, scene);
// var line = BABYLON.CylinderBuilder.CreateCylinder("cylinder", { diameterTop: 0.005 * thickness, height: 0.275, diameterBottom: 0.005 * thickness, tessellation: 96 }, scene);
// lineMesh
let pointsArr = [];
let point1 = new BABYLON.Vector3(0, 0, 0);
let point2 = new BABYLON.Vector3(0, 0, 0.275);
let centerPoint = new BABYLON.Vector3(0, 0, 0.275 / 2);
pointsArr.push(new BABYLON.Vector3(point1.x - centerPoint.x, point1.y - centerPoint.y, point1.z - centerPoint.z));
pointsArr.push(new BABYLON.Vector3(point2.x - centerPoint.x, point2.y - centerPoint.y, point2.z - centerPoint.z));
let currentLine = BABYLON.MeshBuilder.CreateLines("line", { points: pointsArr }, scene);
// currentLine.isPickable = false;
currentLine.material = material;
// line.material = material
cylinder.parent = arrow;
// line.parent = arrow;
currentLine.parent = arrow;
// Position arrow pointing in its drag axis
cylinder.material = material;
cylinder.rotation.x = Math.PI / 2;
cylinder.position.z += 0.3;
currentLine.position.z += 0.275 / 2;
// currentLine.rotation.x = Math.PI / 2;
// line.position.z += 0.275 / 2;
// line.rotation.x = Math.PI / 2;
return arrow;
}
It is strange that the mouse when choosing arrow moving ,the ''pointerInfo.pickInfo.pickedMesh" is “currentLine”. Even if I set “currentLine.isPickable = false;”, the mouse when choosing arrow moving “pointerInfo.pickInfo.pickedMesh” is not "cylinder ".
I would like to know why and how to solve this problem, thank you!