Extrude a line from an already extruded shape vertices

Ok as I said in another post I’m a beginner on Babylon so I’m still getting the ropes of the framework. So I was trying to extrude a line from a known vertices location but not from an existing shape, so is there a way to take a vertex from an extruded polygon and then extrude just a line to a another known position?

So here is my shape in question:

This is a rough idea of what I want but for every top vertex, the thing is that they are created by the for loop and I’m trying to do it by individual lines rather than from a known polygon.

What would be the best way to achieve my goal?

https://playground.babylonjs.com/#I56B00#14 here is playground link (with also the line things that I made down there), to make your life easier the for loops to make the tower starts from line 55.

Again Thanks for any help I get from this.

Edit: searching for a bit I discover the function “createLine”, everything good but the thing is that I still don’t know if I can use it directly from a known vertex in a created shape from a for loop.

If you have the paths then why not just transform the values by in the the extrude amount?

yeah, I did that or at least I think I did that, but babylon is not taking the vertex I want. Sure I can extrude to the amount I want but the thing is to take the vertex I want, like the ones from the top of every shape you see there in the playground.

For example I just did the thing with the lines, and they are relatively “well” but not even on a vertex, see my new playground to understand what I mean https://playground.babylonjs.com/#I56B00#15, so my goal is to connect every shape with one correspondent vertex.

Then you are not transforming the path correctly, the points should be fairly easy to get to.


just from scanning your code this should work to get you the top points of your first box for example.

1 Like

That what I wanted to see! with this now I can have an idea of how to get the vertices I need! thanks!

Ok so… I got it work… kinda, the vertices are actually selected but it takes the origin polygon only, so I want the top or better said the last polygon from the iteration to work not the last one. https://playground.babylonjs.com/#I56B00#16 in my playground the for each actually just take the base vertices, not the last iteration vertices.

So I was thinking if it is possible to use the variable “piso” for something? like use a for each to get the vertices from the last iteration of “piso”?

I wish I understood Italian! I’m just using pattern recognition on your variable names and did not dive in to hard. I’ll take another look here when I get home for you.

1 Like

Is not italian, is spanish :stuck_out_tongue: in any way thanks for the help! I will be eager to hear more from you.

If you want the translation, Piso = floor, torre = tower, plano = plane, and I think the rest is self explanatory.

So I’ve been looking more, I found the VertexBuffer that I thought it gonna be my salvation but instead it gave me the entire list of coordinates, I managed to separate every floor in one variable with “window[“piso”+i+j]” but now I just need to take the last floor of every tower and take their vertex data so that I could use it as a position of the vertex.

https://playground.babylonjs.com/#I56B00#17 this has been my progress so far btw.


1 Like

Omg, finally!!! this is what I wanted in the entire day!! I can’t thank you enough :smiley:

now I can extrude those lines with the algorithm.

one thing tho, can you tell me or give me the part of the documentation where it says about the function “point”? I want to study how it works, I’m gonna need it because now I need to select the points of the respective faces

That’s just the vector element in the array.

A vector can denote a position or a direction, in this instance we wanted a position, so with my parameters naming convention I just call that a “point”.

You could call it whatever.

1 Like