So I am using the following line of code in my app for RayCasting
var ray = scene.createPickingRay(
scene.pointerX,
scene.pointerY,
new BABYLON.Matrix.Identity(),
camera
);
var hit = scene.pickWithRay(ray);
if (hit.pickedMesh) {
console.log("Mesh Picked");
}
but this is only working in ArcCamera and not in the when camera is FollowCamera and UniversalCamera.
Am I missing something or this is how it is written in the BabylonJS?
Phew…!
yeah I was able to reproduce it finally, what I had done is commented the pointer input handler block in which I was using these lines.
// scene.onPointerObservable.add((pointerInfo) => {
// switch (pointerInfo.type) {
// case BABYLON.PointerEventTypes.POINTERDOWN:
console.log("POINTER DOWN");
var ray = scene.createPickingRay(
scene.pointerX,
scene.pointerY,
new BABYLON.Matrix.Identity(),
camera
);
var hit = scene.pickWithRay(ray);
if (hit.pickedMesh) {
console.log("Mesh Picked");
}
// break;
// }
// });
it was a miss from my end as I am working in React Babylon so I run examples on playground and then code them in my project