Reset the dynamic created polygon local origin and pivot

Hello,

In my scene, an object is placed in 3D space, not at world zero (cube). A triangular plane exists at the world center (1st plane).
I am creating another triangular plane by clicking on 3 vertices of the geometry (Cube in this case).
The created plane forms at the required location, however the pivot of the created new plane is at world zero.
I want to reset the pivot of the new created plane to one of the points used to create the plane, (let’s consider the 1st point we picked)
however the pivot still does not set to that point and is at world zero.

I have tried the following methods to reset the pivot.
1.setPivotPoint
2.setPivotMatrix
3.setPositionWithLocalVector

My playground link - https://playground.babylonjs.com/#EYGWW4#1
The goal is to snap the new plane onto the 1st plane that existed at the origin.
The cube is parented to the new plane and hence would reset itself (translation and rotation) to the location of the 1st plane.

Any help or insight on this would greatly help.

Many thanks.

Did you try to set plane vertices position as their intented world position minus the first vertex position (1st vertex is at (0,0,0), others are relative to origin), then set mesh position as the first world position ?

Maybe I missed something in your explanation :slight_smile:

1 Like

Thanking you For your Replay, we already trying this but the dynamic plane also moving…But we need without plane move set local origin.

Then, maybe an intermediate TransformNode that is the parent of the new plane ? If would work like a pivot but with orientation and scale as a bonus.

1 Like