I am trying to make a static mesh shrinking/scaling down only on the Z axis.
It is suppose to be a healthbar but instead of using a widget i need it to be a static mesh that will shrink when the health is being deducted. I have my health system fully set and have tried scaling the static mesh myself but as soon as the game starts the mesh gets distorted into a cube and literally scales down on each axis when damage is inflicted to it.
here is a screenshot of how far I have gotten, any more information needed please let me know.
try using SetTransform, and break the input transform struct (right click → break struct), then you should have a scale input in there.
is this what you meant? the static mesh is not present when I now press play at all…
I need the cube to shrink from top to bottom as my health points get lower
You were scaling it on all axis. This is assuming your health bar is scaled to 1,1,1 at the start though, if not, adjust the numbers.
Also, you don’t really need to do that on tick, you could just scale it whenever there is damage instead.
it doesn’t show up, because you didn’t plug anything to “new location” and “new rotation”, so it gets 0,0,0 input for each, which places it in root location (X:0 Y:0 Z:0) of your world. plug the current location and rotation to these inputs to avoid it.
Hi, for some reason the cube fully dissapears after it gets hit once.
I have 500 healthpoints and the enemy inflicts 100 damage so i would like the cube to shrink 1/5 each time it gets hit if that makes sense?
Make sure the starting scale of your Health mesh is 1 on all axis. Make sure the default value of TowerHealth is set to 500, and that you are applying 100 damage.
okay now were getting somewhere the problem that I have now is it rescales from bottom and top towards the middle… how do i lock it so it only scales from top to bottom?
It will scale around the pivot of the mesh. So, at the moment the pivot is probably at the center. You will have to edit the mesh in whatever program you used to model it. Move the model up so that the base of the mesh is on 0 (so that the bottom of your model is lined up with the lower axis, or “floor”) and then re-export and import your mesh again.
Works exactly as I wanted now :)!! Thank you very much for your efforts and for baring with my beginner skills
[to asker] actually that seems to be your problem, i didn’t notice that wrong conversion you have made from float to vector. try this way before the one i have supplied