How do you click meshes through walls. I know how, but can't program

Hello all, I’ve been moving along with my project, but now I am stuck. Here is my playground. It’s a room where ultimately you should be able to navigate along the floor, up the walls and along the ceiling by clicking on them. There are 931 square meshes making up the room.

In my playground, if you click on the floor, you should move to that position. The problem is if you stray outside the room, and try to click the floor, you are clicking the outside wall…so you would move to that part of the wall. I believe this is a way to avoid this using this method. My walls have the normals set up the same way. The thing is I can’t get it to work…I don’t know how to program it (I have tried). As indicated, the walls and ceiling are clickable too.

If you look at my playground I would suggest just to navigate on the floor. It’s tricky, but you can move around the room using the floor: from the furtherest corners.

Also, I believe there is a simple collision function to stop you going through meshes. I don’t know if that would serve my purpose or not. Again, I tried to program that without luck. Help with this would be appreciated.

I have chosen navigating by squares, as the next step I am hoping to achieve is to attach a small 3d box to the wall or ceiling with a mouse click and keyboard key as I navigate the room. Possibly using this feature The Power of Behaviours

ps, my local version has colour (red), but it’s not showing in the playground.

Possibly something to do with the small camera radius. Large radius you can see better the whole room

Perhaps this custom camera might be more suitable for what you need from Customizing Camera Inputs | Babylon.js Documentation

Also if you look at this example you can get picked points data from a mesh. If your only reason for using multiple square meshes is to pick a point you could create a whole floor from one mesh rather than a number of tiles by picking points.

Hi JohnK, thanks for you’re reply.

Unfortunately, I really need to be inside the room, not hovering above it. This is to be a simulation of someone walking around and attaching devices to walls (or ceiling). So, I am looking for game like movement of walking around a room…being able to look up…maybe attach a device to the ceiling. I feel I am close to a solution if only I can get picking through the walls to work (like this).

The custom camera looks interesting, but I think I would find it difficult to program.

Thanks again.

Hi there, well I managed to progress a tad with this new playground. I have the movement of the camera the way I want it and I seem to be able to pick meshes through the outside walls into the room (try using console.log and click the walls and cylinder from outside the room). I say ‘seem’, as this isn’t working quite the way I thought. I still need to move to the picked mesh.


HOLD ON…DESIRED RESULT…I just this second discovered that when my project was uploaded to the playground, when the camera was outside the room and the cylinder clicked, the camera moved towards it. It stopped at the outside wall but continued when the cylinder was clicked again (this wasn’t the behaviour on my local computer).

In the playground I got through the wall to the cylinder, all be it with 2 clicks, but I got there.

I thought everything was solved. But this feature of picking through the wall to move to the cylinder only worked once. If you leave the boundary of the room and try clicking on the cylinder again you just end up moving to the outside wall.

HOLD ON! I just discovered something else. When the scene loads, and you zoom out a small amount, then click on the cylinder you stop at the outside wall, click the cylinder again…nothing, no movement. If you load the scene, and don’t zoom, you get the DESIRED RESULT mentioned in the paragraph above.

What is going on? I would like the DESIRED RESULT to happen all the time, not just once when my scene loads. Can anyone shed light on this issue?