# Draw a textured plane between two points?

I need to draw a textured plane between 2 points (vector3 and vector3) and texture, what are your views on the best way to do this?

Custom mesh?
Trial and error (work out lol) an equation using plane with rotation?
Ribbon?
Other?

1 Like

I want to add a note here on why it takes 3 points, rather than 2.

With just to points, you can draw a plane, but it could be rotated along the line those 2 points make. The third point is there to actually fix the planeâ€™s rotation.

I have an array of vector3â€™s, inside a group (box as parent), I am trying to draw planes (walls/fence) between those points (x&z), y and height are constants.

I will have to do some r&d tests on the 3rd point rotation thing you mention to understand what it actually does and what impact it has on my needs.

I tried the plane and changing itâ€™s pivot point, but 1/2 that, 1/2 this, degToRad that, radToDeg this etc results in issues, not to mention it starts to get complicated for such a simple bit of pythag.

I will try out the custom mesh, tomorrow. I remember doing custom primitives in Away3D (worked nicer adding vertex arrays instead of a massive array of values and assuming the 3 index increment rule). Thought I would inquire as there might have been a simpler and quicker way to do it these days.

Thanks for the info.

D

I like the plane method because itâ€™s simple and dynamic, like this:
https://playground.babylonjs.com/#R61G9T

You can drag the spheres

Nice playground example, good find.
Thanks for that.

I just threw this together really fast, it probably isnâ€™t super optimized (I think custom meshes should reuse points in the indices array rather than just adding them every single time).
https://playground.babylonjs.com/#7BTLCL

Based on what you said, I think that might be close.

I did something similar, few time ago.
I changed it a little bit to fit your requirements.
https://playground.babylonjs.com/#1GTK9D#8
Maybe will help

Hi MarianG, sorry link doesnâ€™t work.

Sorry, try now

Thanks
Looks like my 1st pythag was fine and that I was over complicating it

I was using tan instead of atan! dohâ€¦
Thanks for that.

1 Like

For future reference:

You can use `GreasedLine` from version 7. Supports `Standard` and `PBR` materials and all the texture stuff included in these materialsâ€¦

https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param/greased_line

2 Likes