I am using localScale.y to scale a cube but I would like the scaling to make the cube “taller” rather than the current way which ends up with half of it through the floor This is most easily explained with a picture. (1) is the original cube. (2) is what I want. (3) is what I get.
Edit: I solved the problem by myself. You can ignore this post.
It does this becaus the anchor point is in the center of the cube. The only way I know to make the anchor point to the bottom is to create your own cube mesh via code.
To do it without going to the effort of creating the mesh yourself, you can simply translate the cube in the Y direction by half of the scale. e.g.
localScale.y = 5;
position.y = position.y + (localScale.y*0.5f);
1 Like
i solved this before your post. Thanx for you help.