I cant save a PG right now for some reason but here:
var createScene = function () {
var scene = new BABYLON.Scene(engine);
var camera = new BABYLON.FreeCamera("camera1", new BABYLON.Vector3(0, 5, -10), scene);
camera.setTarget(BABYLON.Vector3.Zero());
camera.attachControl(canvas, true);
var light = new BABYLON.HemisphericLight("light", new BABYLON.Vector3(0, 1, 0), scene);
light.intensity = 0.7;
var ground = BABYLON.MeshBuilder.CreateGround("ground", {width: 6, height: 6}, scene);
var ray = new BABYLON.Ray(new BABYLON.Vector3(4, 0, 0), new BABYLON.Vector3(-1, 0, 0), 4)
new BABYLON.RayHelper.CreateAndShow(ray, scene, BABYLON.Color3.Red())
let pick = scene.pickWithRay( ray, ( mesh )=>{
return true
})
console.log(pick)
return scene;
};
This would ideally still capture a hit, I am wondering why it is not detecting the ground plane.