Jump to content

create ground mesh from a plane


Recommended Posts


   I want to create a ground mesh from a plane.

let plane = new Plane(-0.4, -0.2, -0.6, 0.1); //normal and offset
let planeMesh = Mesh.CreateGround("planeMesh", 100, 100, 2,  scene);
//to make the planeMesh to fit the plane, transformation should be added to the mesh
planeMesh.rotation = ...
planeMesh.positon = ... 

someone can help me out?


Link to comment
Share on other sites

Hello Yokewang !

When you do a new BABYLON.Plane, you create a "mathematical" plane in 3D-space. It is of course not rendered because it is infinite.
When you do a BABYLON.MeshBuilder.CreateGround(..) you create a mesh which is coplanar to the XOZ Plane of your scene, with a given size, vertices number etc...

To make your mesh fit your mathematical data, you need to align your mesh with your data's normal (the rotation) and change your mesh position to fit the offset of the math Plane.
To do it, you can use :

Here is a simple playground showing this solution.

Link to comment
Share on other sites

Hi @yokewang  and welcome to the forum.

@Amarth2Estel  gave an excellent solution a little lost in the PG. Since you cannot change the sideOrientation to BABYLON.Mesh.DOUBLESIDE you cannot see the plane from the position of the camera.

A change to camera type and position get you https://playground.babylonjs.com/#72YAXV#1


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...