# Capsule component shrink and offset

Hi guys

Let say we create capsule component:
capsule half height - 35

We create timeline which will linearly change output float from 0 to 1. Then add 2 variables: halfheight 35 and half height 13.
When connecting that values to a,b of lerp input respectively, and timeline output to lerp alpha for.
So when we start out timeline we shrink our capsule to sphere.

But our sphere are (literally! no physics enabled!) stand on the ground in begin, so when we start animation, in the end our sphere will floating above the ground, cause we change capsule height relative to pivot which are in the center of capsule.

Okay we need add some offset in Z axis which will put our sphere to the ground.

If we draw that 2 figure (capsule and sphere) on paper or use CAD software, and look how much offset value we need, we can solve it this way: (capsule halfheight - (capsule radius2))/2.
So (35 - (7.5
2))/2 = 10
I will attach some picture to prove that simple formula. Look at figures and numbers at the bottom of image.

Thats a blueprint for all of that. We shrink sphere and try to stay on the ground by adding offset in Z axis. If float “offset_z” = -10, which looks like right value because geometry and simple math are proving that, actually in the end of animation sphere will be still float above the ground.
If we set “offset_z” = -20 when sphere will stay on the ground all time.

Can enybody explain me where im getting wrond? -20 looks like absolutely incorrect value for me but it works, and -10 - not.

blueprintue:

And yes. It looks like my calculations are wrond because half heigth is not a full heigth of the capsule, but if i create capsule component with 35 halfheight and cube with 35x35x35 size, what cube will have height exactly as capsule component.