GreasedLine direction

Hi,

Probably a silly question, but I can’t get this square to show properly.

As you can see, only 2 lines are drawn. If I get rid of the ribbonoptions then it does work, however, I need to use it in a case where they don’t face the camera.

Thanks,

cc @roland the mastermind behind greaselines

2 Likes

If it can help :
I think in ribbon mode, you can pass the two sets of points : Playground

++
Tricotou

2 Likes

Thanks Tricotou, this works nicely! My bad for not looking deep enough in the documentations, although I wish there was a simpler implementation.

1 Like

In addition to @Tricotou ‘s answer you can specify directions when creating the line in ribbon mode. Your PG with the flat array points should work with the direction specified.

Here is a nice example (this one uses 2D arrays though, but demonstrates the direction property):
ArcRotateCamera axes are confusing - #12 by roland

Docs;
https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param/greased_line/greased_line_ribbon#direction-and-width

General advice:
Don’t use Vector3’’s when specifying the points array unless you really need to. Use plain numbers. Vectors are converted to numbers anyway when creating the line mesh.

1 Like