I have been able to change the height of a cube geometry mesh by using mesh.scale.y however this is unsatisfactory as i only want to increase it upwards or downwards but when I scale it it changes uniformly in both directions upwards and downwards. Is there a simple way of doing this without scale which requires to update the position adjusting for the bottom or top to make it look like its growing in one direction only.
PS - Couldnt find a forum to post this question in so gave up searching on google and posted it here. Also would like to thank the Three.js team for this amazing framework as writing straight WebGL which I was doing was a taking too long.
mesh.scale.y += delta;
mesh.translateY( delta / 2 );
Thanks a lot
For anyone stumbling upon this now, a little clarification.
mesh.scale.y += delta
changes the scale of the mesh, so if the scale is 1 and you add 1, the mesh doubles.
mesh.translateY()
moves the mesh by a physical distance. So if the y value of the mesh is 5 pixels, adding 1 moves it to 6.
Instead of translateY(delta/2)
, you should figure out how much the mesh.scale.y += delta
physically increases/decreases the mesh, then you should translate by half that amount.
Most helpful comment