Jump to content

Why parameters on Geometries have no effect?


leota
 Share

Recommended Posts

I have created a BoxGeometry and then added it to a Mesh. The problem is that no matter what size a give it, it always gets rendered as size=1.

I also created a box using BABYLON.MeshBuilder.CreateBox(), and there it works fine, size is updated as expected.

Here's the PG: http://playground.babylonjs.com/#UUJWXS

Problem is at line 14:

var box = new BABYLON.BoxGeometry('box', scene, 8, true, mesh, 4);

as you can see size is set to 8, but actually it gets rendered smaller the the other box which has size 4.

Link to comment
Share on other sites

Where have seen that a box could be created just from a geometry object ?

In BJS, a geometry is a logical (maths) object. A geometry is created when a mesh is created usually. Not the inverse. You can create a geometry for logical purposes and attach it to any mesh, but this won't change the mesh shape.

Link to comment
Share on other sites

29 minutes ago, jerome said:

Where have seen that a box could be created just from a geometry object ?

In BJS, a geometry is a logical (maths) object. A geometry is created when a mesh is created usually. Not the inverse. You can create a geometry for logical purposes and attach it to any mesh, but this won't change the mesh shape.

I come from Three.js, where you create a geometry and the assign it to a Mesh, and that's what the mesh will look like. So from what you're saying this is not possible in BJS, and I'm a bit confused about some concepts.

What's the purpose of having a BoxGeometry class then? Can you please make a pratical example where I can use geometries?

Link to comment
Share on other sites

The goal is not to have two concepts for one thing: the geometry is an internal storage that can be used by several meshes but you should not have to worry about.

You want a sphere? BABYLON.Mesh.CreateSphere is the way to go. For more control you can also use BABYLON.MeshBuilder.CreateSphere

They will both return meshes.

 

Internally there is a geometry that can be shared between meshes if you create clone.

Link to comment
Share on other sites

27 minutes ago, Deltakosh said:

The goal is not to have two concepts for one thing: the geometry is an internal storage that can be used by several meshes but you should not have to worry about.

You want a sphere? BABYLON.Mesh.CreateSphere is the way to go. For more control you can also use BABYLON.MeshBuilder.CreateSphere

They will both return meshes.

 

Internally there is a geometry that can be shared between meshes if you create clone.

Ok thanks, it makes sense now.

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