Hi Guys, I am new to babylon, so not sure what I have done wrong. I have this class that I am trying get a hit on what is under the mouse pointer.
export default class Wall extends GameObject {
CurrentGame: Game;
CurrentScene: Scene;
constructor(game: Game) {
super("Wall", game);
this.CurrentGame = game;
this.CurrentScene = game.scene;
this.RegisterObserver();
}
RegisterObserver() {
this.scene.onPointerObservable.add(this.HandlePointerAction);
}
HandlePointerAction(pInfo: PointerInfo) {
// console.log(pInfo);
// console.log(evt);
console.log(pInfo.event.x + ", " + pInfo.event.y);
var Hit = this.CurrentScene.pick(
pInfo.event.x,
pInfo.event.y,
(pickedMesh) => pickedMesh.name == "Ground"
);
switch (pInfo.type) {
case PointerEventTypes.POINTERDOWN:
//console.log(Hit);
break;
case PointerEventTypes.POINTERMOVE:
break;
}
}
}
I keep getting this error message. Not sure why.