Position of the ground is fixed relative to my camera

unfortunately I have a big problem to solve in the shortest time:

the mission is to add many objects in the scene after a click with the mouse. Following an impossibility to have the intersection directly with the scene (I think it’s impossible) I had to add a plan at the scene.(like a ground)

var pickPlane = BABYLON.Mesh.CreatePlane(“mesh1”, 10000, scene);
pickPlane.billboardMode = BABYLON.Mesh.BILLBOARDMODE_ALL;

the problem is that I have to put the position of this plan is fixed relative to my camera or to find a solution without ground: /

thanks for help :slight_smile:

Hey @issam_abdelhedi,

Would love to help, but it’s a little difficult to understand the problem. Can you provide a playground that we can look at in order to help?

1 Like

it’s possible to add object with mouse click directly at scene (without ground ) !!!

I’m not sure this is the most elegant solution ever, but it seems to work ok.

https://playground.babylonjs.com/#BSFPWL

1 Like

You can also pick a virtual plane:

https://playground.babylonjs.com/#BSFPWL#1

Edit:

I just realized you don’t even need a plane…
https://playground.babylonjs.com/#BSFPWL#2

2 Likes

thanks for ur time @Gijs and @PirateJC , i just add camera.attachControl(canvas, true); to your code @Gijs .
I want when i rotate the camera and i add a new sphere, the position of the new sphere will be at the origin(like i don’t rotate the scene ).

I hope you understand me :slight_smile:

Here’s a new playground with a new placing code:

https://playground.babylonjs.com/#BSFPWL#3

When you increase the ground size, the problem seems to be that when you rotate, the plane goes through the camera, is that the problem you are facing? Does this playground come closer to completing your mission?

1 Like

the problem is that when I rotate the scene, the position of the scene does not remain fixed with the camera

I thnik that what i want :
https://playground.babylonjs.com/#BSFPWL#6
thanks for u :smiley:

1 Like