Currently, I am adjusting the vertices of my cube along the y-axis.
Although this method works well when simply moving the cube, issues arise when I begin rotating it. The movements continue to follow the global y-axis even during rotation. Is there a way to separate the rotation and movement of the vertices to avoid this behavior?
Visit this link for code reference
void main()
{
vec4 modelPosition = modelMatrix * vec4(position, 1.0);
float displacement = sin(uTime) * 2.;
modelPosition.y += displacement;
vec4 viewPosition = viewMatrix * modelPosition;
vec4 projectedPosition = projectionMatrix * viewPosition;
gl_Position = projectedPosition;
}