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

To create a plane between three points:

https://doc.babylonjs.com/how_to/custom
https://www.babylonjs-playground.com/#VKBJN#7

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

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 :slight_smile:

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

I was using tan instead of atan! doh…
Thanks for that.

1 Like