Jump to content

Extruding a mesh on the Y axis doesn't work


KarelAnker
 Share

Recommended Posts

http://imgur.com/PDBj6MG

 

Basically I'm trying to extrude a shape on the Y axis. All of the points have a Y of 0, only the X and Z are differing each time.

When you're looking at the picture, you can see the white lines are the points connected by BABYLON.MeshBuilder.CreateLines, so the points shouldn't be the problem. However, if you are looking at that big grey thing going in the air, that's the extruded shape from the points. It seems that it doesn't extrude properly on the Y axis so it's really messed up.

 

The code looks like this:

BABYLON.MeshBuilder.CreateLines("line", { points: meshPoints }, scene);var block = BABYLON.MeshBuilder.ExtrudeShape("block", {shape: meshPoints,path: [new BABYLON.Vector3(0, -1, 0), new BABYLON.Vector3(0, 0, 0)],scale: 1,cap: BABYLON.Mesh.CAP_ALL}, scene);

As you can see, I just want it to be extruded from the bottom to the top, which should result in a box which follows the mesh points. It should look like the white lines, but then filled up and having a "height" to it.

Link to comment
Share on other sites

Just convert your array points (or clone it to another) so you redfine the shape in the xOy plane.

The model shape is not a mesh, it's just a logical model : a series of vector3

I've partially fixed it, however there's one problem which I can't figure out: http://www.babylonjs-playground.com/#RF9W9#181

 

As you can see, when you add the "cap" option, there are some weird black parts and parts which shouldn't be capped at all. 

(PS: I added some alpha so you can see the yellow line representing the shape..)

Link to comment
Share on other sites

The computation of the barycenter for extruded shape caps is a design choice (cf previous posts in another topic) to keep a good performance when  morphing dynamically the extruded shape : http://www.babylonjs-playground.com/#20IBWW#2

It works quite well for concave model shape but can have weird results for conves ones.

Maybe, in your case, you might use the polygon builder instead of the extrusion embedded capping.

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