Jump to content

Options from the official tutorial does not work


8Observer8
 Share

Recommended Posts

This is the final code from the official tutorial: https://playground.babylonjs.com/#Y092BP

If you open the official tutorial you will see this line of code in the beginning of the tutorial:

// create a built-in "ground" shape; 
var ground = BABYLON.Mesh.CreateGround('ground1', {height:6, width:6, subdivisions: 2}, scene);

But in the final code you will see this line of code:

// create a built-in "ground" shape;
var ground = BABYLON.Mesh.CreateGround('ground1', 6, 6, 2, scene);

If I write {height:6, width:6, subdivisions: 2} instead 6, 6, the code doesn't work: https://playground.babylonjs.com/#Y092BP#1

But for a sphere this works: {segments:16, diameter:2}

Link to comment
Share on other sites

Hi. If you want to use a custom build of a basic element, you have to use 

MeshBuilder, instead of Mesh, for your example:
// create a built-in "ground" shape;
var ground = BABYLON.Mesh.CreateGround('ground1', 6, 6, 2, scene);

and 

// create a built-in "ground" shape; 
var ground = BABYLON.MeshBuilder.CreateGround('ground1', {height:6, width:6, subdivisions: 2}, scene); // not BABYLON.Mesh

It is a mistake on the doc, it'll be fixed. :)

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.

Guest
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.

Loading...
 Share

  • Recently Browsing   0 members

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