Look at this example. I have a imported .glb file for a custom plane mesh in blue, and a code-created plane mesh in red by MeshBuilder. I don’t wanna use ReflectionProbe for this, just using MirrorTexture with renderList. I can make it correct for the red one, but no idea for the blue one (look at line 109th).
Another question, is there a way to get a random Vector3 point from a mesh’s surface? For each splitted flat planes, I think it may help a lot then I can get 3 of that for defining a plane for mirror texture
You can create a plane from a point + the normal at this point.
So, just take any point in the list of vertices of the mesh (
mesh.getVerticesData("position")) and the corresponding normal in
mesh.getVerticesData("normal") to create the plane:
Note that your mesh is not plane, though, so the mirror will work on the side corresponding to the normal used to create the mirror but not on the other side.