Hi.
I am trying to rotate the vertices starting at 0.33 and less based on the uv.y but it is not rotating them correctly. It is like it is rotated from the center, I tried a pivot but still no luck, I am lost, any help is appreciated it.
void main() {
vUv = uv;
vec3 newPosition = position;
// Define the oneThird pivot threshold
float oneThird = 1.0 / 3.0;
// Define the rotation angle
float bendAngle = radians(90.0); // Rotate by 90 degrees
// Pivot point is at the Y-coordinate of oneThird
vec3 pivot = vec3(oneThird, 0.0, 0.0);
// Rotate vertices below the oneThird threshold
if (vUv.y <= oneThird) {
// Translate vertices to the pivot point
newPosition.x -= pivot.x;
// Rotate around the X-axis
newPosition = rotate(newPosition, vec3(1.0, 0.0, 0.0), bendAngle);
// Translate vertices back from the pivot point
newPosition.x += pivot.y;
}
// Final position
gl_Position = projectionMatrix * viewMatrix * modelMatrix * vec4(newPosition, 1.0);
}