Expand In One Direction

I have a bit of a conundrum that I dont know how to solve.

I want to have a cube that when the player presses the fire button, expands forward(lengthens) so that its like a pole infront of the player.

My idea was to just use a cube, and then when the button is pressed expand the z scale to whatever length I want.

The problem is that the z scale expands in both directions, so I have a length coming out the back of the player as well.

Is there any way to tell Unity to only expand z forward?

Thank you for any help.

You must make a cube with a modeling application, and make sure the pivot center is located on a face of the cube, with z axis pointing towards the inside of the cube.

Or you can add an empty gameobject to the back end of the cube, and simply use that as a sort of attachment point. Though, Akilae’s solution is much simpler.

This worked perfectly, thank you once again :slight_smile: