How do you place objects around an existing mesh?

Hi there, I am wondering if there is a simple solution to this. In my playground I have what is supposed to be a room that you can walk about in, by clicking the floor. For now, I have removed the walls but left the ceiling for convenience in clicking the floor.
I would like a small glb or obj mesh to attach to the ceiling area when clicked (the file will contain 2 meshes). I hope to disable camera movement when clicking the ceiling…only the floor will be used for navigation.
So, in the end I am looking to attach objects anywhere on the roof area (blocks.obj) where the mouse clicks (ideally slightly inside the room).
Any help would be greatly appreciated…thanks. :smiley:

Would restricting camera movement to only certain meshes work for you eg see line 86 https://www.babylonjs-playground.com/#MZM8Q9#1

Hi JohnK, thanks for your quick response.
To be honest, for now, I wasn’t too bothered about the moving towards the ceiling issue. It was the ability to click around the roof area attaching objects I was hoping to get help with. But it looks like you have solved the moving towards the ceiling issue…thanks, that’s great.
Do you happen to know how to solve my main issue: clicking the roof, and top wall area, to add a small mesh (obj)?
Cheers.

Possibly add another if statement and if name of picked mesh means it is a roof mesh then add box at picked point or relative to picked mesh.

Hi again, thanks for your answer.
I found this, it kind of does what I want. I’m assuming it will work if I swap the ground for my roof block. However, how would I get the dropped object (a sphere in this case) to stay? I don’t want it to disappear when the mouse is clicked at another location…I want around15 - 20 objects.
Cheers.

Here is slightly modified version of your PG - https://playground.babylonjs.com/#035R4B#1
It works only for 3 clicks/meshes, but I hope you’ll get the idea.

Hi Iabris, thanks for your response…this is good. I am wondering if this method would work with a glb file?

I thought I better make a rough glb mesh of what I hope to be the finished piece (comprised of 2 meshes: devSource devRange) …it can be seen here I have a position gizmo attached, as I want to be able to move the object after it has appeared from the initial mouse click (hoping to keep this movement to inside the room’s roof space…but that’s for later).

Just so you know, I’m hoping to be able to change the colour of the outer sphere (devRange)…may be by holding down a key before the mouse is clicked (3 colours only).

Anyway, for now I’m just looking to add the glb model.

Cheers.

Here is the draft example with the model added (4th click) - https://playground.babylonjs.com/#035R4B#2

Iabris, thanks again for the example. Great to see how a model is brought in.

I’m just wondering if there is a way of producing around 12 ‘devices’ (I renamed ‘skull’ to ‘devices’ here) and for the device only to appear when there is a click around the ground area. And how can the ground be excluded from the position gizmo.
Cheers.